Link to home
Start Free TrialLog in
Avatar of Blowfelt82
Blowfelt82

asked on

VBScript Query XML at multiple levels.

I have XML in the following format...

<xml>
 <machine id="512">
  <type name="Windows" />
  <external>
   <type name="Linux" />
   <type name="Apple" />
  </external>
 </machine>
</xml>

Open in new window


This XML is loaded into an object named OSystem. I query this as follows...

Set Nodes = OSystem.SelectNodes("/machine[@id='512']/")
Set Items = Nodes.getElementsByTagName ("type")

Open in new window


This returns the Windows type element, I need a way to get all type elements at both the machine and machine/external level. So all 3 basically...

Preferably if this can be done in one statement, but if two are needed and then the sets could be joined than this could be an option?
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

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