Browse Source

2004-05-05 Atsushi Enomoto <[email protected]>

	* BuiltInDatatype.cs : added BUGGY_MS_COMPLIANT condition and that
	  handles ms-compatible properties.
	* XmlSchemaComplexType.cs : ditto for ContentTypeParticle of xs:anyType.
	  Make sure ContentType for xs:anyType is Mixed.
	* XmlSchemaUtil.cs : ditto for <xs:attribute use="prohibited" ..>

svn path=/trunk/mcs/; revision=26737
Atsushi Eno 21 years ago
parent
commit
b13d1c2c41

+ 8 - 0
mcs/class/System.XML/System.Xml.Schema/BuiltInDatatype.cs

@@ -70,7 +70,11 @@ namespace Mono.Xml.Schema
 		}
 
 		public override Type ValueType {
+#if BUGGY_MS_COMPLIANT
+			get { return typeof (string); }
+#else
 			get { return typeof (object); }
+#endif
 		}
 
 		public override XmlTokenizedType TokenizedType {
@@ -1290,7 +1294,11 @@ namespace Mono.Xml.Schema
 		}
 
 		public override XmlTokenizedType TokenizedType {
+#if true//BUGGY_MS_COMPLIANT
+			get { return XmlTokenizedType.None; }
+#else
 			get { return XmlTokenizedType.CDATA; }
+#endif
 		}
 
 		public override Type ValueType {

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

@@ -1,3 +1,11 @@
+2004-05-05  Atsushi Enomoto <[email protected]>
+
+	* BuiltInDatatype.cs : added BUGGY_MS_COMPLIANT condition and that
+	  handles ms-compatible properties.
+	* XmlSchemaComplexType.cs : ditto for ContentTypeParticle of xs:anyType.
+	  Make sure ContentType for xs:anyType is Mixed.
+	* XmlSchemaUtil.cs : ditto for <xs:attribute use="prohibited" ..>
+
 2004-05-05  Atsushi Enomoto <[email protected]>
 
 	* XmlSchema.cs : Write() handles schema namespace for xmlserializer

+ 16 - 1
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs

@@ -45,10 +45,15 @@ namespace System.Xml.Schema
 					anyType = new XmlSchemaComplexType ();
 					anyType.Name = "";	// In MS.NET, it is not "anyType"
 					anyType.QNameInternal = XmlQualifiedName.Empty;	// Not xs:anyType as well.
+#if BUGGY_MS_COMPLIANT
+					anyType.validatableParticle = XmlSchemaParticle.Empty; // This code makes validator handles these schemas incorrectly: particlesIb001, mgM013, mgH014, ctE004, ctD004
+#else
 					anyType.validatableParticle = XmlSchemaAny.AnyTypeContent;
+#endif
 					anyType.contentTypeParticle = anyType.validatableParticle;
 					anyType.DatatypeInternal = XmlSchemaSimpleType.AnySimpleType;
 					anyType.isMixed = true;
+					anyType.resolvedContentType = XmlSchemaContentType.Mixed;
 				}
 				return anyType;
 			}
@@ -157,7 +162,6 @@ namespace System.Xml.Schema
 
 		internal XmlSchemaParticle ValidatableParticle 
 		{
-//			get{ return validatableParticle; }
 			get{ return contentTypeParticle; }
 		}
 
@@ -424,6 +428,11 @@ namespace System.Xml.Schema
 			// leave resolvedDerivedBy as Empty
 			if (Particle != null)
 				validatableParticle = Particle;
+			if (this == AnyType) {
+				resolvedContentType = XmlSchemaContentType.Mixed;
+				return;
+			}
+
 			if (validatableParticle == XmlSchemaParticle.Empty) {
 				// note that this covers "Particle == null" case
 				if (this.IsMixed)
@@ -806,6 +815,10 @@ namespace System.Xml.Schema
 
 					foreach (DictionaryEntry entry in baseComplexType.AttributeUses) {
 						XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
+#if BUGGY_MS_COMPLIANT
+						if (attr.Use != XmlSchemaUse.Prohibited)
+							XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
+#endif
 						XmlSchemaUtil.AddToTable (attributeUses, attr, attr.QualifiedName, h);
 					}
 				}
@@ -993,6 +1006,8 @@ namespace System.Xml.Schema
 			}
 
 			// 5.
+			if (this == AnyType)
+				return;
 			if (contentTypeParticle == XmlSchemaParticle.Empty) {
 				// 5.1
 				if (ContentType != XmlSchemaContentType.Empty) {

+ 8 - 1
mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs

@@ -489,12 +489,15 @@ namespace System.Xml.Schema
 						grp.AttributeGroupRecursionCheck = false;
 					}
 					if (grp.AnyAttributeUse != null) {
-						// FIXME: should validate wildcard subset validity. See spec 3.10.6
 						if (anyAttribute == null)
 							anyAttributeUse = grp.AnyAttributeUse;
 					}
 					foreach (DictionaryEntry entry in grp.AttributeUses) {
 						XmlSchemaAttribute attr = (XmlSchemaAttribute) entry.Value;
+#if BUGGY_MS_COMPLIANT
+						if (attr.Use == XmlSchemaUse.Prohibited)
+							continue;
+#endif
 						if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty)
 							AddToTable (attributesResolved, attr, attr.RefName, h);
 						else
@@ -504,6 +507,10 @@ namespace System.Xml.Schema
 					XmlSchemaAttribute attr = xsobj as XmlSchemaAttribute;
 					if (attr != null) {
 						errorCount += attr.Validate (h, schema);
+#if BUGGY_MS_COMPLIANT
+						if (attr.Use == XmlSchemaUse.Prohibited)
+							continue;
+#endif
 						if (attr.RefName != null && attr.RefName != XmlQualifiedName.Empty)
 							AddToTable (attributesResolved, attr, attr.RefName, h);
 						else