[Mono-dev] Adding namespaces to an XmlDocument not working

Stifu stifu at free.fr
Sat Mar 14 05:20:15 EDT 2009


I did a quick search on all Mono XmlDocument bugs, and none mentioned
namespaces, so I guess it's not known. Please report it.

Instructions: http://mono-project.com/Bugs#How_to_make_a_good_bug_report


Hiawatha wrote:
> 
> Hi guys..  I have the following code that works perfectly on .NET:
> 
>          string xml = "<Foo><Dynamic:bar>123</Dynamic:bar></Foo>";
> 
>          XmlDocument doc = new XmlDocument();
>          NameTable nt = new NameTable();
>          XmlNamespaceManager nsmgr = new XmlNamespaceManager(nt);
>          nsmgr.AddNamespace("Dynamic", "urn:Test");
> 
>          XmlParserContext parserContext = new XmlParserContext(null,
> nsmgr, null, XmlSpace.Default);
>          XmlReader reader = XmlReader.Create(new StringReader(xml), null,
> parserContext);
>          doc.Load(reader);
> 
>          Console.WriteLine("Results:\n" + doc.DocumentElement.OuterXml);
>          Console.ReadLine();
> 
> However, if I run it under Mono I get the exception:
> 
> Unhandled Exception: System.Xml.XmlException: 'Dynamic' is undeclared
> namespace.  Line 1, position 19.
> 
> Any ideas on why this is?  Is this a known bug, or is there somewhere I
> can log it?  Thanks!!
> 
> Mike
> 

-- 
View this message in context: http://www.nabble.com/Adding-namespaces-to-an-XmlDocument-not-working-tp22507321p22510741.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list