NameSpace Confusion
Messages   Related Types
This message was discovered on microsoft.public.dotnet.xml.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Matt
I have attached an XML document that uses the following definition in the
root element xmlns="http://www.rosettanet.org/RNIF/V02.00";. When I load
the attached XML into an XmlDocument object then try to perform XPath
queries I get nothing back. I know it has to do with the namespace but I
have not run across one like this before and I am not very good with
namespaces. I take and create a namespace object and just assigned "me" as
the identifier and then I was able to get the root back with the XPath
"/me:ServiceHeader". But then I went to the next level and got nothing
back. Do I have to use"me:" on all levels because of the way it is defined
or is their an easier way.

Thanks,

Matt

Reply to this message...
 
    
Dare Obasanjo [MSFT] (VIP)
"Matt" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Yes, because all the elements in the document are in that namespace.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

Reply to this message...
 
    
Matt
Dare,

Thanks I understand how the NamespaceManager comes into play when working
directly with the XmlDocument.

Now when I run my stylesheet against the XmlDocument using XslTransform none
of my selects work. How do I handle this situation in the stylesheet since
I can't add a NamespaceManager to the Transform method?

Thanks,

Matt
"Dare Obasanjo [MSFT]" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Krish (VIP)
Matt, Namespace on the root element should not cause any issues with XSLT
transform.
Krish

"Matt" wrote:

[Original message clipped]

Reply to this message...
 
    
Oleg Tkachenko [MVP] (VIP)
Matt wrote:

[Original message clipped]

XSLT dosn't need any NamespaceManagers. XSLT stylesheet is XML document
so it handles namespaces natively - just declare the same namespace in
xsl:stylesheet element and use that prefix in your selections.

--
Oleg Tkachenko [XML MVP]
http://blog.tkachenko.com
Reply to this message...
 
    
Matt
Thanks Oleg.

Matt

"Oleg Tkachenko [MVP]" <oleg@NO!SPAM!PLEASEtkachenko.com> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Xml.XmlDocument
System.Xml.Xsl.XslTransform




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com