XPath on an XML document with namespace?

If you are using C# then you need to specify the namespace for the "anyType" element in your XPath.

If you are using C# then you need to specify the namespace for the "anyType" element in your XPath: var xml = new XmlDocument(); xml. LoadXml( "your xml" ); var names = new XmlNamespaceManager( xml. NameTable ); names.

AddNamespace( "xsi", "w3.org/2001/XMLSchema-instance" ); names. AddNamespace( "a", "tempuri.org/" ); var nodes = xml. SelectNodes( "//a:anyType@xsi:type='Document'", names ).

I think that //anyTypenamespace-uri() = "w3.org/2001/XMLSchema-instance"local-name() = "type" Will do what you want.

Thanks, I think what's wrong in my original expression is I need to prefix anyType with the namespace "xmlns". – EnToutCas Feb 18 '09 at 17:20.

Had nearly the same problem, I forgot to add the correct namespace for xsi:type (w3.org/2001/XMLSchema-instance" rel="nofollow">w3.org/2001/XMLSchema-instance) was using w3.org/2001/XMLSchema and I did never get any result - now it is working the following way.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions