I have a question on XML with Javascript. Here is my situation:
I have two xml documents (1.xml and 2.xml) with similar structure:
[HTML]<person>
<data>
<value>1</value>
<value>2</value>
</data>
</person>[/HTML]
Using Javascript, I managed to load the 1.xml document, store the <value> nodes into a variable called valueNodes.
Expand|Select|Wrap|Line Numbers
- var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
- xmlDoc.load("note.xml");
- var personNode = xmlDoc.getElementsByTagName("person").item(0);
- var dataNode = personNode.getElementsByTagName("data").item(0);
- valueNodes = dataNode.getElementsByTagName("value");
Expand|Select|Wrap|Line Numbers
- valueNodes = valueNodes + dataNode.getElementsByTagName("value");
Expand|Select|Wrap|Line Numbers
- valueNodes = valueNodes & dataNode.getElementsByTagName("value");
Any suggestions are appreciated :) Thanks!
Yenyen