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

Hiawatha imaudi at comcast.net
Sat Mar 14 14:28:51 EDT 2009


Thanks!

Bug 485419 Submitted..


Stifu wrote:
> 
> 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-tp22507321p22515608.html
Sent from the Mono - Dev mailing list archive at Nabble.com.



More information about the Mono-devel-list mailing list