D
daz_oldham
Hi Everyone
I was wondering if anyone knew of a good guide to working with multiple
namespaces under .NET? And also help me with my latest poser.
As you may have calculated by my other posts, I am working under a lot
of new technologies that I didn't realise I would be when I took the
job - so I am on a steep learning curve (too steep at times!!! lol).
Very basically, I want to be able to do some XPath on XML I am getting
back from a web-service, and I have worked out that I need to apply my
DTDs because there is an xmlns attribute in my root element.
<Root Target="test" Version="2002A"
xmlns="http://www.testurl.com/abc/2002/09">
I have seen how to do this with an XmlNamespaceManager, but when I do
something like:
nsmRequest.AddNamespace("ns1",
"http://localhost/ABC_ReturnAvailRS.xsd");
XmlNode node = xdHotels.SelectSingleNode("//ns1:ABC_ReturnAvailRS.xsd",
nsmRequest);
I just get a null value.
I have 'invented' that prefix because I cannot see a named prefix in my
xsd - but I have also tried String.Empty() and get null back.
The one thing I may be doing wrong is that in my ABC_ReturnAvailRS.xsd
there is:
<xs:include schemaLocation="ABC_CommonTypes.xsd"/>
And in this file there is:
<xs:include schemaLocation="ABC_SimpleTypes.xsd"/>
So does this mean I have to add these to my XmlNamespaceManager
instance? And what do I do about giving each namespace a named
instance?
Hopefully I have made some sense here - and as ever I thank you for
taking the time to cast your eye over this for me.
Many many thanks
Best regards
Darren
I was wondering if anyone knew of a good guide to working with multiple
namespaces under .NET? And also help me with my latest poser.
As you may have calculated by my other posts, I am working under a lot
of new technologies that I didn't realise I would be when I took the
job - so I am on a steep learning curve (too steep at times!!! lol).
Very basically, I want to be able to do some XPath on XML I am getting
back from a web-service, and I have worked out that I need to apply my
DTDs because there is an xmlns attribute in my root element.
<Root Target="test" Version="2002A"
xmlns="http://www.testurl.com/abc/2002/09">
I have seen how to do this with an XmlNamespaceManager, but when I do
something like:
nsmRequest.AddNamespace("ns1",
"http://localhost/ABC_ReturnAvailRS.xsd");
XmlNode node = xdHotels.SelectSingleNode("//ns1:ABC_ReturnAvailRS.xsd",
nsmRequest);
I just get a null value.
I have 'invented' that prefix because I cannot see a named prefix in my
xsd - but I have also tried String.Empty() and get null back.
The one thing I may be doing wrong is that in my ABC_ReturnAvailRS.xsd
there is:
<xs:include schemaLocation="ABC_CommonTypes.xsd"/>
And in this file there is:
<xs:include schemaLocation="ABC_SimpleTypes.xsd"/>
So does this mean I have to add these to my XmlNamespaceManager
instance? And what do I do about giving each namespace a named
instance?
Hopefully I have made some sense here - and as ever I thank you for
taking the time to cast your eye over this for me.
Many many thanks
Best regards
Darren