Click here to Skip to main content
15,887,336 members
Home / Discussions / XML / XSL
   

XML / XSL

 
GeneralRe: create multiple XML files Pin
Pete O'Hanlon1-Dec-10 4:21
mvePete O'Hanlon1-Dec-10 4:21 
QuestionC# XML Query Website address based on Website name Pin
Wheels01224-Nov-10 6:01
Wheels01224-Nov-10 6:01 
AnswerRe: C# XML Query Website address based on Website name Pin
Tarun.K.S24-Nov-10 7:30
Tarun.K.S24-Nov-10 7:30 
GeneralRe: C# XML Query Website address based on Website name Pin
Wheels01224-Nov-10 7:41
Wheels01224-Nov-10 7:41 
GeneralRe: C# XML Query Website address based on Website name Pin
Tarun.K.S24-Nov-10 7:50
Tarun.K.S24-Nov-10 7:50 
GeneralRe: C# XML Query Website address based on Website name Pin
Wheels01224-Nov-10 7:59
Wheels01224-Nov-10 7:59 
GeneralRe: C# XML Query Website address based on Website name Pin
Tarun.K.S24-Nov-10 18:18
Tarun.K.S24-Nov-10 18:18 
QuestionHow to populate an XmlNamespaceManager Pin
PIEBALDconsult13-Nov-10 5:17
mvePIEBALDconsult13-Nov-10 5:17 
In order to use SelectNodes to select nodes and attributes that have a namespace prefix, you need an XmlNamespaceManager that knows about the namespace and prefix. Unfortunately, I haven't found a way to access a pre-populated XmlNamespaceManager or to automagically populate one from an XmlDocument.

According to the documentation, XmlReaders use XmlNamespaceManagers, so after I load a document with an XmlReader I should be able to copy the XmlReader's XmlNamespaceManager -- but it shows null (and requires Reflection). I should be able to pass an XmlNamespaceManager to an XmlReader and the XmlReader should use it -- but it still shows null.

I've gone through a bunch of documentation and searching articles here and elsewhere hasn't yielded a silver bullet. They all show code calling AddNamespace to add specific namespaces -- I need it to be dynamic.

So I'm trying to roll my own. At this point, I'm loading the document with an XmlReader and then trying to query any attributes in the xmlns namespace, I should then be able to populate an XmlNamespaceManager with AddNamespace.

The code, as I have it now (I've tried several variations of the XPath) is:

System.Xml.XmlNamespaceManager result =
    new System.Xml.XmlNamespaceManager ( Document.NameTable ) ;

System.Xml.XmlNodeList nodes = Document.DocumentElement.SelectNodes ( "//@xmlns:*" , result ) ;


This should yield all the attributes in the xmlns namespace (and the document contains one), but the list comes up empty.

0) Can anyone provide me with an XPath that will do what I want?
1) Does anyone know how to get a pre-populated XmlNamespaceManager from an XmlReader or an XmlDocument?
AnswerRe: How to populate an XmlNamespaceManager Pin
Ger Hayden13-Nov-10 7:11
Ger Hayden13-Nov-10 7:11 
AnswerRe: How to populate an XmlNamespaceManager -- update Pin
PIEBALDconsult15-Nov-10 2:38
mvePIEBALDconsult15-Nov-10 2:38 
GeneralRe: How to populate an XmlNamespaceManager -- update Pin
lorenkins16-Nov-10 6:45
lorenkins16-Nov-10 6:45 
GeneralRe: How to populate an XmlNamespaceManager -- update Pin
PIEBALDconsult16-Nov-10 18:22
mvePIEBALDconsult16-Nov-10 18:22 
QuestionRead XML in C# Pin
ShafiqA3-Oct-10 19:02
ShafiqA3-Oct-10 19:02 
AnswerRe: Read XML in C# Pin
Ger Hayden16-Oct-10 3:06
Ger Hayden16-Oct-10 3:06 
AnswerRe: Read XML in C# Pin
PIEBALDconsult13-Nov-10 4:47
mvePIEBALDconsult13-Nov-10 4:47 
AnswerRe: Read XML in C# Pin
Tarun.K.S19-Nov-10 23:16
Tarun.K.S19-Nov-10 23:16 
GeneralRe: Read XML in C# Pin
Tarun.K.S20-Nov-10 1:54
Tarun.K.S20-Nov-10 1:54 
AnswerRe: Read XML in C# Pin
Yvan Rodrigues13-Dec-10 14:42
professionalYvan Rodrigues13-Dec-10 14:42 
Questionxml Pin
vijiajai25-Sep-10 19:37
vijiajai25-Sep-10 19:37 
QuestionNewDataset in XSD Pin
indian14320-Sep-10 5:05
indian14320-Sep-10 5:05 
AnswerRe: I got the answer for this Pin
indian14320-Sep-10 6:40
indian14320-Sep-10 6:40 
QuestionUpating xml in C# Pin
Sonar8724-Aug-10 22:56
Sonar8724-Aug-10 22:56 
AnswerRe: Upating xml in C# Pin
SeMartens25-Aug-10 4:27
SeMartens25-Aug-10 4:27 
GeneralRe: Upating xml in C# Pin
Sonar8725-Aug-10 10:11
Sonar8725-Aug-10 10:11 
Questionxlst - format number function Pin
Simon_Whale4-Aug-10 4:15
Simon_Whale4-Aug-10 4:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.