[Mono-bugs] [Bug 485419] New: Adding namespace with XmlNamespaceManager::AddNamespace() does not work as expected

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Mar 14 14:28:02 EDT 2009


https://bugzilla.novell.com/show_bug.cgi?id=485419


           Summary: Adding namespace with
                    XmlNamespaceManager::AddNamespace() does not work as
                    expected
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.2.x
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: Sys.XML
        AssignedTo: atsushi at ximian.com
        ReportedBy: imaudi at comcast.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_6; en-us)
AppleWebKit/525.27.1 (KHTML, like Gecko) Version/3.2.1 Safari/525.27.1

Repro code / test case:

         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(doc.DocumentElement.OuterXml);



Reproducible: Always

Steps to Reproduce:
1. Use above test code to create sample console program, be sure to reference
System.Xml
2. Run program

Actual Results:  
Crash:

Unhandled Exception: System.Xml.XmlException: 'Dynamic' is undeclared
namespace.  Line 1, position 19.
  at Mono.Xml2.XmlTextReader.ReadStartTag () [0x0053e] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1488 
  at Mono.Xml2.XmlTextReader.ReadContent () [0x00135] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlTextReader.cs:1314 
  at Mono.Xml2.XmlTextReader.Read () [0x00141] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlTextReader.cs:611 
  at System.Xml.XmlTextReader.Read () [0x0006b] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlTextReader2.cs:566 
  at System.Xml.XmlDocument.ReadNodeCore (System.Xml.XmlReader reader)
[0x00186] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlDocument.cs:917 
  at System.Xml.XmlDocument.ReadNode (System.Xml.XmlReader reader) [0x00032] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlDocument.cs:838 
  at System.Xml.XmlDocument.Load (System.Xml.XmlReader xmlReader) [0x00019] in
/usr/src/packages/BUILD/mono-2.2/mcs/class/System.XML/System.Xml/XmlDocument.cs:708 
  at XmlTest.Program.Main (System.String[] args) [0x00044] in
/home/mono/Projects/XmlTest/XmlTest/Main.cs:23 


Expected Results:  
Value of "xml" should be written to console.

Code works as expected using .NET CLR 3.5 (and I would guess earlier versions)

-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list