Click here to Skip to main content
15,886,807 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a simple vbscript code:

VB
Set xmlDom = CreateObject("MSXML2.DOMDocument.6.0")

xmlDom.async = False
xmlDom.loadXML "<?xml version='1.0'?>" & _
    "<Root xmlns='MyNameSpace'>" & _
        " <Test> This is a Test " & _
            " <Test2> This is a Test2   " & _
                " <Test3> Node 1 " & _
                " </Test3> " & _
            " </Test2>" & _
        " </Test> " & _
        "  <Test3> Node 2 </Test3>" & _
    "</Root>"
Wscript.Echo ".getProperty( SelectionLanguage ) = " & .getProperty( "SelectionLanguage" )
xmlDom.setProperty "SelectionLanguage", "XPath"
xmlDom.setProperty "SelectionNamespaces", "xmlns:myNS='MyNameSpace'"

Set oNode = xmlDom.selectSingleNode("//myNS:Test3[position()=2]")

Wscript.Echo oNode.xml



It produce error.
I need to get a node with defined position.
Posted
Comments
Maciej Los 7-Mar-14 17:25pm    
What's error message?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900