瀏覽代碼

2004-11-18 Atsushi Enomoto <[email protected]>

	* XmlSchemaCollection.cs : obsolete.
	* XmlSchemaInference.cs :
	  Fixed typo in enum. It is still MonoTODO. Reformatted code a bit.



svn path=/trunk/mcs/; revision=36238
Atsushi Eno 21 年之前
父節點
當前提交
cd6a5293f4

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

@@ -1,3 +1,9 @@
+2004-11-18  Atsushi Enomoto <[email protected]>
+
+	* XmlSchemaCollection.cs : obsolete.
+	* XmlSchemaInference.cs :
+	  Fixed typo in enum. It is still MonoTODO. Reformatted code a bit.
+
 2004-11-17  Atsushi Enomoto <[email protected]>
 
 	* XmlSchemaSet.cs : don't set TargetNamespace = "".

+ 3 - 0
mcs/class/System.XML/System.Xml.Schema/XmlSchemaCollection.cs

@@ -40,6 +40,9 @@ namespace System.Xml.Schema
 	/// XmlSchemaCollection is originally designed to be conformant to 
 	/// W3C specification).
 	/// </summary>
+#if NET_2_0
+	[Obsolete ("Use XmlSchemaSet.")]
+#endif
 	public sealed class XmlSchemaCollection : ICollection, IEnumerable
 	{
 		//private fields

+ 18 - 8
mcs/class/System.XML/System.Xml.Schema/XmlSchemaInference.cs

@@ -65,15 +65,16 @@ using Choice = System.Xml.Schema.XmlSchemaChoice;
 
 namespace System.Xml.Schema
 {
+	[MonoTODO ("merge primitive types; infer gYearMonth too; in some cases sequence should contain element whose minOccurs=0 (no obvious rules right now); reject some non-supported schema components")]
 	public class XmlSchemaInference
 	{
 		public enum InferenceOption {
+			Restricted,
 			Relaxed,
-			Rstricted
 		}
 
-		InferenceOption occurrence = InferenceOption.Rstricted;
-		InferenceOption typeInference = InferenceOption.Rstricted;
+		InferenceOption occurrence = InferenceOption.Restricted;
+		InferenceOption typeInference = InferenceOption.Restricted;
 
 		public XmlSchemaInference ()
 		{
@@ -94,7 +95,8 @@ namespace System.Xml.Schema
 			return InferSchema (xmlReader, new XmlSchemaSet ());
 		}
 
-		public XmlSchemaSet InferSchema (XmlReader xmlReader, XmlSchemaSet schemas)
+		public XmlSchemaSet InferSchema (XmlReader xmlReader,
+			XmlSchemaSet schemas)
 		{
 			return XsdInference.Process (xmlReader, schemas,
 				occurrence == InferenceOption.Relaxed,
@@ -104,7 +106,10 @@ namespace System.Xml.Schema
 
 	class XsdInference
 	{
-		public static XmlSchemaSet Process (XmlReader xmlReader, XmlSchemaSet schemas, bool laxOccurence, bool laxTypeInference)
+		public static XmlSchemaSet Process (XmlReader xmlReader, 
+			XmlSchemaSet schemas,
+			bool laxOccurence,
+			bool laxTypeInference)
 		{
 			XsdInference impl = new XsdInference (xmlReader,
 				schemas, laxOccurence, laxTypeInference);
@@ -135,7 +140,10 @@ namespace System.Xml.Schema
 		Hashtable newElements = new Hashtable ();
 		Hashtable newAttributes = new Hashtable ();
 
-		private XsdInference (XmlReader xmlReader, XmlSchemaSet schemas, bool laxOccurence, bool laxTypeInference)
+		private XsdInference (XmlReader xmlReader, 
+			XmlSchemaSet schemas, 
+			bool laxOccurence, 
+			bool laxTypeInference)
 		{
 			this.source = xmlReader;
 			this.schemas = schemas;
@@ -169,7 +177,8 @@ namespace System.Xml.Schema
 		{
 			if (schemas.Schemas (NamespaceXml).Count == 0)
 				// FIXME: do it from resources.
-				schemas.Add (NamespaceXml, "http://www.w3.org/2001/xml.xsd");
+				schemas.Add (NamespaceXml, 
+					"http://www.w3.org/2001/xml.xsd");
 		}
 
 		private void InferElement (Element el, string ns, bool isNew)
@@ -947,7 +956,8 @@ namespace System.Xml.Schema
 			}
 			try {
 				double dbl = XmlConvert.ToDouble (value);
-				if (float.MinValue <= dbl && dbl <= float.MaxValue)
+				if (float.MinValue <= dbl &&
+					dbl <= float.MaxValue)
 					return XmlSchemaType.GetBuiltInSimpleType (XmlTypeCode.Float).QualifiedName;
 				else
 					return XmlSchemaType.GetBuiltInSimpleType (XmlTypeCode.Double).QualifiedName;