Object Attr CDATASection
CharacterData Comment Document DocumentFragment
DocumentType Entity EntityReference Node
Notation ProcessingInstruction Text
Object.nextSibling
The nextSibling property returns the next node in the parent's child list, or
null if there is none or the node is of a type that cannot be a child node
(Attr,
Document,
DocumentFragment).
The example that follows uses the 'passeriformes.xml' file which details
the bird families belonging to that order. It first gets the
firstChild node of the root, and then uses the
nextSibling property to print the text of the node that follows it.
XML:
<passeriformes>
<family>
<f_name>Alaudidae</f_name>
<species>Woodlark</species>
<species>Skylark</species>
<species>Shore Lark</species>
</family>
<family>
<f_name>Motacillidae</f_name>
<species>Rock Pipit</species>
<species>Water Pipit</species>
<species>Yellow Wagtail</species>
</family>
<family>
<f_name>Turdidae</f_name>
<species>Robin</species>
<species>Nightingale</species>
<species>Blackbird</species>
</family>
</passeriformes>
Code (VBScript):
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load("passeriformes.xml")
Dim child1, child2
Set child1 = objXMLDoc.documentElement.firstChild
Set child2 = child1.nextSibling
document.write(child2.text)
Output:
Motacillidae Rock Pipit Water Pipit Yellow Wagtail
|