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?

RE: Is there anything located at http://schemas.microsoft.com/crm/2006 by Patrick

Patrick
Wed May 17 04:09:01 CDT 2006

No, there is nothing there. There isn't any reason anything is required to be
there.
The namespace of the xml document is 'http://schemas.microsoft.com/crm/2006'
and that is all it is just a name which happens to be formated like a url.

A bit of info on Xml namespaces.
A namespace is part of the name of a node.
This:
<node xmlns:myNamespace="http://somename.local">
<myNamespace:child1 />
<child2 />
</node>
declares a namespace with local reference myNamespace the node child is in
that namespace while child2 isn't.

This:
<node>
<child1 xmlns="http://somename.local">
<child3/>
</child1>
<child2 />
</node>
declares a namespace and tells the xml processor that node child1 is in that
namespace as well as all its child nodes, child 3 in this case. child2 isn't
part of that namespace.

if you want to use Xpaths you need to take this into account because:
<node>
<child1 xmlns="http://somename.local"/>
<child1 />
</node>
a select with XPath '//child1' will only return the second node.

In .Net you need to use a NamespaceManager to use XPath selects with
namespaces.
Basicaly for your document it would be something like

XmlDocument dom = new XmlDocument();
dom.LoadXml( ... );
XmlNamespaceManager nsManager = new XmlNamespaceManager(dom.NameTable);
nsManager.AddNamespace("",
"http://schemas.microsoft.com/crm/2006/WebServices");
nsManager.AddNamespace("nn",
"http://schemas.microsoft.com/crm/2006/WebServices");

XmlNode address2_cityNode = dom.SelectSingleNode("//nn:address2_city",
nsManager);





--
Patrick Verbeeten (MCSD)
Lead Developer
Aviva IT
Web: aviva-it.nl


"Shelvin Datt" wrote:

> 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?
>
>
>
>
>

RE: Is there anything located at http://schemas.microsoft.com/crm/ by ShelvinDatt

ShelvinDatt
Wed May 17 22:13:02 CDT 2006

Thank you Patrick for your prompt reply, it has made sense to me.

It seems that I have a steep learning curve up ahead.

"Patrick" wrote:

> No, there is nothing there. There isn't any reason anything is required to be
> there.
> The namespace of the xml document is 'http://schemas.microsoft.com/crm/2006'
> and that is all it is just a name which happens to be formated like a url.
>
> A bit of info on Xml namespaces.
> A namespace is part of the name of a node.
> This:
> <node xmlns:myNamespace="http://somename.local">
> <myNamespace:child1 />
> <child2 />
> </node>
> declares a namespace with local reference myNamespace the node child is in
> that namespace while child2 isn't.
>
> This:
> <node>
> <child1 xmlns="http://somename.local">
> <child3/>
> </child1>
> <child2 />
> </node>
> declares a namespace and tells the xml processor that node child1 is in that
> namespace as well as all its child nodes, child 3 in this case. child2 isn't
> part of that namespace.
>
> if you want to use Xpaths you need to take this into account because:
> <node>
> <child1 xmlns="http://somename.local"/>
> <child1 />
> </node>
> a select with XPath '//child1' will only return the second node.
>
> In .Net you need to use a NamespaceManager to use XPath selects with
> namespaces.
> Basicaly for your document it would be something like
>
> XmlDocument dom = new XmlDocument();
> dom.LoadXml( ... );
> XmlNamespaceManager nsManager = new XmlNamespaceManager(dom.NameTable);
> nsManager.AddNamespace("",
> "http://schemas.microsoft.com/crm/2006/WebServices");
> nsManager.AddNamespace("nn",
> "http://schemas.microsoft.com/crm/2006/WebServices");
>
> XmlNode address2_cityNode = dom.SelectSingleNode("//nn:address2_city",
> nsManager);
>
>
>
>
>
> --
> Patrick Verbeeten (MCSD)
> Lead Developer
> Aviva IT
> Web: aviva-it.nl
>
>
> "Shelvin Datt" wrote:
>
> > 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?
> >
> >
> >
> >
> >