You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@xerces.apache.org by Gareth Reakes <ga...@decisionsoft.com> on 2000/10/31 11:22:07 UTC
DOM_NodeList iterator
Hello all.
I am having a bit of a problem (using 1_3 on Linux). If my tree is this
<data>a
<element>b
<subElement >I want this text</subelement>
<subElement1/>This is an example line.
<subElement2/>d
</element>e
<element>f
<subElement1/>h
<subElement2/>i
</element>j
</data>
and I select /data/element/subelement as my root node
DOM_NodeIterator i = node.getOwnerDocument().createNodeIterator(node,
DOM_NodeFilter::SHOW_ALL, 0, true);
DOMString textcontent = L"";
DOM_Node next = i.nextNode();
while(!next.isNull()) {
textcontent.appendData(next.getNodeValue());
next = i.nextNode();
}
return textcontent;
returns what I expect - "I want this text". However if I change the tree
to this:
<data>a
<element>b
<subElement />I want this text
<subElement1/>This is an example line.
<subElement2/>d
</element>e
<element>f
<subElement1/>h
<subElement2/>i
</element>j
</data>
then I get the following output
I want this text
This is an example line.
d
e
f
h
i
j
when I was expecting nothing at all. Am I being stupid or is this a
problem?
Gareth