http://schemas.microsoft.com/crm/2006/WebServices
When accessing the following I get a The system cannot find the path
specified.
I am trying to read a XML document with the following name space and get an
error.
The XML document is encoded (nested) within a Soap Envelope that is returned
via a Web Service.
Here is the XML:-
<?xml version="1.0" encoding="utf-8"?>
<BusinessEntity xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://schemas.microsoft.com/crm/2006/WebServices">
<address2_city>Manukau</address2_city>
<address2_line3>4:00 a.m.</address2_line3>
<address2_postalcode>1702</address2_postalcode>
<contactid>ca2b6278-cedb-da11-8c13-0003ff6799dc</contactid>
<firstname>DANIELLE</firstname>
<lastname>BUTLER</lastname>
<new_address2_country name="New Zealand">1</new_address2_country>
<new_address2_line4>Lupton Road</new_address2_line4>
<new_address2_line5>Manurewa</new_address2_line5>
<new_title name="Mrs">1</new_title>
</BusinessEntity>
I am using XPath to navigate to the address2_city node but get an error.
The path I am using is /BusinessEntity/address2_city
The interesting thing is that when I remove the
xmlns="http://schemas.microsoft.com/crm/2006/WebServices"> from the XML
document I am able to use the path /BusinessEntity/address2_city to navigate
to the address2_city node.
Why is this.
If I alter the original XML document as follows than I am able to use the
path /BusinessEntity/address2_city to get to the node.
<?xml version="1.0" encoding="utf-8"?>
<BusinessEntity xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:def="http://schemas.microsoft.com/crm/2006/WebServices">
<address2_city>Manukau</address2_city>
<address2_line3>4:00 a.m.</address2_line3>
<address2_postalcode>1702</address2_postalcode>
<contactid>ca2b6278-cedb-da11-8c13-0003ff6799dc</contactid>
<firstname>DANIELLE</firstname>
<lastname>BUTLER</lastname>
<new_address2_country name="New Zealand">1</new_address2_country>
<new_address2_line4>Lupton Road</new_address2_line4>
<new_address2_line5>Manurewa</new_address2_line5>
<new_title name="Mrs">1</new_title>
</BusinessEntity>
Also interesting is that when using System.XML in .Net I get the following
XPath:-
/def:BusinessEntity/def:address2_city
to navigate to the node.
Can someone explain this to me, Please?