Topic
Using Xpath to parse XML containing namespaces in the Web Request control.
Instructions
To successfully query XML containing namespaces in the Web Request control you must add wild cards for each element after the last element containing a namespace. Alternatively, you can bypass all nodes and find only the desired node.
Example XML Response:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<AddResponse xmlns="http://tempuri.org/">
<AddResult>2</AddResult>
</AddResponse>
</soap:Body>
</soap:Envelope>
Example XPath queries:
wildcards after namespace
/soap:Envelope/soap:Body/*/*
selecting only desired nodes:
//*[local-name()='AddResult']