The values of nodeName, nodeValue, and attributes vary according to the node type as follows:
http://xml.apache.org/xerces-c/apiDocs/classDOMNode.html#z229_0
(Look at Detailed Description)
For a DOMText getNodeName return #Text but getNodeValue return the Text.
Sylvain.
At 14:57 13/04/04 -0700, you wrote:
Hi all,
I have a simple XML string: <d><id>1</id></d>
After parsing this string, I wrote a function to
traverse this DOM tree to get the node name/pairs.
I'm running into a weird problem when I try to get the
node name of <d>'s child (which is "id"):
Note: In the following code, the current node being
processed is <d>.
(1) This piece of code works, and the print out is
"id":
DOMNodeList *children = node->getChildNodes();
cout <<
XMLString::transcode((children->item(1))->getNodeName())
<< endl;
(2) This code does not work, and the print out is
"#text":
cout <<
XMLString::transcode((node->getFirstChild())->getNodeName())
<< endl;
Does anyone know why the "getFirstChild()" function
does not return the expected results? Is this a bug?
Thanks for your time and help.
Regards,
Monica
__________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online by April 15th
http://taxes.yahoo.com/filing.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]