Просмотр исходного кода

2009-03-16 Atsushi Enomoto <[email protected]>

	* XmlParserContext.cs : .NET has weird nametable initialization.
	  Fixed bug #484519.

	* XmlParserContextTests.cs : added test for bug #484519.


svn path=/trunk/mcs/; revision=129483
Atsushi Eno 17 лет назад
Родитель
Сommit
af866ca922

+ 5 - 0
mcs/class/System.XML/System.Xml/ChangeLog

@@ -1,3 +1,8 @@
+2009-03-16  Atsushi Enomoto  <[email protected]>
+
+	* XmlParserContext.cs : .NET has weird nametable initialization.
+	  Fixed bug #484519.
+
 2009-03-16  Atsushi Enomoto  <[email protected]>
 
 	* XmlReader.cs : (ReadToFollowing) check LocalName, not Name.

+ 1 - 2
mcs/class/System.XML/System.Xml/XmlParserContext.cs

@@ -156,9 +156,8 @@ namespace System.Xml
 			XmlSpace xmlSpace,
 			Encoding enc)
 		{
-			this.nameTable = nt;
-
 			this.namespaceManager = nsMgr;
+			this.nameTable = nt != null ? nt : nsMgr != null ? nsMgr.NameTable : null;
 			if (dtd != null) {
 				this.DocTypeName = dtd.Name;
 				this.PublicId = dtd.PublicId;

+ 4 - 0
mcs/class/System.XML/Test/System.Xml/ChangeLog

@@ -1,3 +1,7 @@
+2009-03-16  Atsushi Enomoto  <[email protected]>
+
+	* XmlParserContextTests.cs : added test for bug #484519.
+
 2009-03-16  Atsushi Enomoto  <[email protected]>
 
 	* XmlReaderCommonTests.cs : added test for bug #480066.

+ 12 - 0
mcs/class/System.XML/Test/System.Xml/XmlParserContextTests.cs

@@ -159,5 +159,17 @@ namespace MonoTests.System.Xml
 			Assert.AreEqual ("", pc.XmlLang, "#B9");
 			Assert.AreEqual (XmlSpace.Preserve, pc.XmlSpace, "#B10");
 		}
+
+		[Test]
+		public void NameTableConstructor ()
+		{
+			NameTable nt = new NameTable ();
+			XmlNamespaceManager nsmgr = new XmlNamespaceManager (nt);
+			nsmgr.AddNamespace("Dynamic", "urn:Test");
+			Assert.IsNotNull (new XmlParserContext (nt, nsmgr,
+null, XmlSpace.Default).NameTable, "#1");
+			Assert.IsNotNull (new XmlParserContext (null, nsmgr,
+null, XmlSpace.Default).NameTable, "#2"); // bug #485419
+		}
 	}
 }