Link to home
Start Free TrialLog in
Avatar of P-Daddy
P-Daddy

asked on

Select XML node with Namespaces using Classic ASP

I have an XML file that uses namespaces. I need to access these nodes using classic ASP. I've done this before on a different XML file that did not use namespaces using something like:

For Each wNode In xmlDoc2.SelectNodes("/inv-balance/item") 

Open in new window


Apparently, that won't work this time since the XML uses namespaces.

Here is the XML file I'm working with. How do I access the nodes using classic ASP and namespaces?

<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
<S:Body>
<ns2:getInventoryQtyTransitDaysResponse xmlns:ns2="http://impl.webservice.integration.sanmar.com/">
<return>
<errorOccurred>false</errorOccurred>
<listResponse xsi:type="ns2:item" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">
<style>ST350</style>
<color>Iron Grey</color>
<size>XS</size>
<inventoryKey></inventoryKey>
<sizeIndex></sizeIndex>
<shipToPostalCode>99202</shipToPostalCode>
<quantity>69</quantity>
<daysInTransit>1</daysInTransit>
</listResponse>


<listResponse xsi:type="ns2:item" xmlns:xsi="http://www.w3.org/2001/XMLSchemainstance">
<style>ST350</style>
<color>Iron Grey</color>
<size>S</size> 
<inventoryKey></inventoryKey>
<sizeIndex></sizeIndex>
<shipToPostalCode>99202</shipToPostalCode>
<quantity>500</quantity>
<daysInTransit>1</daysInTransit>
</listResponse>



<message>Request fulfilled successfully</message>
</return>
</ns2:getInventoryQtyTransitDaysResponse>
</S:Body>
</S:Envelope>

Open in new window


My ASP code so far:

set xmlDoc2 = createObject("MSXML2.DOMDocument")
xmlDoc2.async = False
xmlDoc2.setProperty "ServerHTTPRequest", true
xmlDoc2.load("http://www.sportsupplygroup.com/Sanmar/transit.xml")
For Each oNode In xmlDoc2.SelectNodes(?????)

Open in new window

Avatar of P-Daddy
P-Daddy

ASKER

I need to access the size node.
ASKER CERTIFIED SOLUTION
Avatar of Gertone (Geert Bormans)
Gertone (Geert Bormans)
Flag of Belgium 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