[Mono-dev] Adding namespaces to an XmlDocument not working
atsushieno at veritas-vos-liberabit.com
Mon Mar 16 14:07:27 EDT 2009
Thanks. It was fixed. The reason why it didn't work was because
your code is weird to dare pass null NameTable to
XmlParserContext.ctor() while you have explicit NameTable in use
to XmlNamespaceManager. We usually don't track such too
> 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,
>>> Console.WriteLine("Results:\n" + doc.DocumentElement.OuterXml);
>>> 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!!
More information about the Mono-devel-list