Link to home
Start Free TrialLog in
Avatar of barryk2
barryk2

asked on

vbscript & selectSingleNode() - XPATH query not getting desired results

Hello,
This question is urgent but probably not difficult.

I need someone to give me the correct syntax for my xpath query.

Basically I want to grab the <desired> node and its associated attributes. Since it is at the root level in vbscript I tried to get it with:
set node = objXmlDoc.documentElement.selectSingleNode("//desired")
* I also tried leaving the syntax("//") inside the selectSingleNode but I kept getting back nothing.

after googling xpath I came across something that led me to beleive I may not be able to access the <desired> node because of its position. If this is true I would then move <desired> inside element :<element><desired name= etc/></element> I also tried a similar xpath query for that("//element/desired") but I kept getting an error.

Can anyone show me an vbscript selectSingleNode call with valid xpath syntax that would get my desired nodes?

<root>
<desired name="bob" computername="winbox"/>
<element>
</element>
<another_element>
</another_element>
</root>
ASKER CERTIFIED SOLUTION
Avatar of drichards
drichards

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of barryk2
barryk2

ASKER

Weird- it must have been a typo on my part that this did not worked. My original code worked. Thanks for the help