Procházet zdrojové kódy

2005-02-25 Atsushi Enomoto <[email protected]>

	* XmlAttribute.cs : MS does not reject non-NCName prefix. Patch by
	  Konstantin Triger.

	* XmlAttributeTests.cs : added nonNCName Prefix case.


svn path=/trunk/mcs/; revision=41181
Atsushi Eno před 21 roky
rodič
revize
71fa56f043

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

@@ -1,3 +1,8 @@
+2005-02-25  Atsushi Enomoto <[email protected]>
+
+	* XmlAttribute.cs : MS does not reject non-NCName prefix. Patch by
+	  Konstantin Triger.
+
 2005-02-24  Atsushi Enomoto <[email protected]>
 
 	* XmlTextWriter.cs : WriteString() should be valid when 

+ 0 - 2
mcs/class/System.XML/System.Xml/XmlAttribute.cs

@@ -193,8 +193,6 @@ namespace System.Xml
 			set {
 				if (IsReadOnly)
 					throw new XmlException ("This node is readonly.");
-				if (!XmlChar.IsNCName (value))
-					throw new ArgumentException ("Specified name is not a valid NCName: " + value);
 				if (name.Prefix == "xmlns" && value != "xmlns")
 					throw new ArgumentException ("Cannot bind to the reserved namespace.");
 

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

@@ -1,3 +1,7 @@
+2005-02-25  Atsushi Enomoto <[email protected]>
+
+	* XmlAttributeTests.cs : added nonNCName Prefix case.
+
 2005-02-24  Atsushi Enomoto <[email protected]>
 
 	* XmlTextWriterTests.cs : Test for call to WriteRaw() -> WriteString()

+ 15 - 0
mcs/class/System.XML/Test/System.Xml/XmlAttributeTests.cs

@@ -316,5 +316,20 @@ namespace MonoTests.System.Xml
 			AssertEquals (XmlNodeType.Text, attr.ChildNodes [0].NodeType);
 			AssertEquals (String.Empty, attr.ChildNodes [0].Value);
 		}
+
+		[Test]
+		public void CrazyPrefix ()
+		{
+			XmlDocument doc = new XmlDocument ();
+			doc.AppendChild (doc.CreateElement ("foo"));
+			doc.DocumentElement.SetAttribute ("a", "urn:a", "attr");
+			XmlAttribute a = doc.DocumentElement.Attributes [0];
+			a.Prefix ="hoge:hoge:hoge";
+			// This test is nothing more than ****.
+			AssertEquals ("hoge:hoge:hoge", a.Prefix);
+			// The resulting string is not XML (so broken), so 
+			// it should not be tested.
+			// doc.Save (TextWriter.Null);
+		}
 	}
 }