i have some xml stored in javascript:
<picture>
<date>5-5-2007</date>
<title>Picture title</title>
<filename>filename.jpg</filename>
<size>6x4</size>
</picture>
i have stored "picture"
Expand|Select|Wrap|Line Numbers
- var XMLinfo = xmlDoc.getElementsByTagName('picture');
Expand|Select|Wrap|Line Numbers
- var n = XMLinfo.childNodes.length;
- var output = "";
- for (i=0;i<n;i++)
- {
- if (infoName != "#text" && infoName != "")
- {
- output += XMLinfo.childNodes[i].nodeName;
- output += ": ";
- //this is the line with the problem
- output += XMLinfo.childNodes.item(i).nodeValue;
- }
- }
- alert(output);
It shows the node names but Ive tried all sorts of combinations of syntax for the second line but cant get it to show the value.
Also tried:
Expand|Select|Wrap|Line Numbers
- infoName = XMLinfo.childNodes[i].nodeName; XMLinfo.getElementsByTagName(infoName)[0].childNodes[0].nodeValue
Anybody see where i am going wrong?
thanks!
Andy