[thelist] XML DOM question (possibly a silly one, possibly not)
Paul Cowan
evolt at funkwit.com
Wed Jul 6 20:48:50 CDT 2005
Hey all,
One of my colleagues here is having a bit of an issue with the MS XML DOM
objects and, not being overly familiar with them, thought I'd handball the
query onto thelist.
Suppose the following XML fragment:
<mynode>
Some data. More data. <![CDATA[ Some data with < in it. ]]>
<subnode>
A subnode smack in the middle of the other nodes.
</subnode>
The last bit of data.
</mynode>
is represented by an object "mynode". He wants to get all the text of
"mynode", without including subelements... so he'd like
Some data. More data. Some data with < in it. The last bit of data.
but if he calls mynode.text, he gets
Some data. More data. Some data with < in it. A subnode smack
in the middle of the other nodes. The last bit of data.
Is there an easy way to do this? He can obviously do a loop through the
child nodes of mynode, check if they're type TEXT_NODE or
CDATA_SECTION_NODE, and if so append their value to a string but he's
convinced there's a better way to do it in one fell swoop. Any ideas?
Thanks in advance for your help,
Paul Cowan
More information about the thelist
mailing list