Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XML Element "Value" 1

Status
Not open for further replies.

davidbook

Programmer
Nov 24, 2003
7
US
Hi, can't seem to figure out how to return "1234", "David" or "Book" from this xml doc..

<Reports>
<Report>
<UserNumber>1234</UserNumber>
<FirstName>David</FirstName>
<LastName>Book</LastName>
</Report>
</Report>

myXML.childNode[0].childNode[0].childNode[0].nodeName <<< Returns &quot;UserNumber&quot; as expected..
myXML.childNode[0].childNode[0].childNode[0].nodeType <<< Returns &quot;Element&quot; as expected..
myXML.childNode[0].childNode[0].childNode[0].nodeValue <<< Returns &quot;NULL&quot; ???? << This is what I need to get...

Any help would be great
thnx....




 
You need to go one level deeper to get to the node value:

trace(myXML.childNodes[0].childNodes[0].childNodes[0].childNodes[0].nodeValue);

returns &quot;1234&quot; in your example.
 
I thought I tried that? I got to thinking earlier this evening that I would try toString(), we will see. I'll try in later. Thanks tons for your reply.
david
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top