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

* TypeTranslator.cs: Added new primitive types: NMTOKEN and NCName.
* XmlSerializationWriterInterpreter.cs: Write XmlAttributes with the prefix
they have.

svn path=/trunk/mcs/; revision=16519

Lluis Sanchez 22 лет назад
Родитель
Сommit
0ea2f093aa

+ 6 - 0
mcs/class/System.XML/System.Xml.Serialization/ChangeLog

@@ -1,3 +1,9 @@
+2003-07-22  Lluis Sanchez Gual <[email protected]>
+
+	* TypeTranslator.cs: Added new primitive types: NMTOKEN and NCName.
+	* XmlSerializationWriterInterpreter.cs: Write XmlAttributes with the prefix
+	  they have.
+
 2003-07-15  Lluis Sanchez Gual <[email protected]>
 
 	* SoapReflectionImporter.cs, XmlReflectionImporter.cs: Avoid generating two

+ 5 - 1
mcs/class/System.XML/System.Xml.Serialization/TypeTranslator.cs

@@ -52,6 +52,8 @@ namespace System.Xml.Serialization
 
 			primitiveTypes.Add ("date", new TypeData (typeof (DateTime), "date", true));	// TODO: timeInstant
 			primitiveTypes.Add ("time", new TypeData (typeof (DateTime), "time", true));
+			primitiveTypes.Add ("NMTOKEN", new TypeData (typeof (string), "NMTOKEN", true));
+			primitiveTypes.Add ("NCName", new TypeData (typeof (string), "NCName", true));
 		}
 
 		public static TypeData GetTypeData (Type type)
@@ -86,7 +88,9 @@ namespace System.Xml.Serialization
 
 		public static TypeData GetPrimitiveTypeData (string typeName)
 		{
-			return (TypeData) primitiveTypes[typeName];
+			TypeData td = (TypeData) primitiveTypes[typeName];
+			if (td == null) throw new NotSupportedException ("Data type '" + typeName + "' not supported");
+			return td;
 		}
 	}
 }

+ 1 - 1
mcs/class/System.XML/System.Xml.Serialization/XmlSerializationWriterInterpreter.cs

@@ -163,7 +163,7 @@ namespace System.Xml.Serialization
 				if (extraAtts != null) 
 				{
 					foreach (XmlAttribute attr in extraAtts)
-						WriteAttribute (attr.LocalName, attr.NamespaceURI, attr.Value);
+						WriteAttribute (attr.Prefix, attr.LocalName, attr.NamespaceURI, attr.Value);
 				}
 			}