2003-10-23 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
authorAtsushi Eno <atsushieno@gmail.com>
Thu, 23 Oct 2003 16:02:08 +0000 (16:02 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Thu, 23 Oct 2003 16:02:08 +0000 (16:02 -0000)
* XsdParticleValidationState.cs : Default content processing shoule be
  lax.
* XsdValidatingReader.cs : If there is no trial to get schemas for
  namespaces, then validation against such namespace should be failed.
  It now uses XmlSchemaAttribute.ValidatedUse instead of .Use.
* XsdWildcard.cs : Fixed incorrect intersection computing.

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

mcs/class/System.XML/Mono.Xml.Schema/ChangeLog
mcs/class/System.XML/Mono.Xml.Schema/XsdParticleValidationState.cs
mcs/class/System.XML/Mono.Xml.Schema/XsdValidatingReader.cs
mcs/class/System.XML/Mono.Xml.Schema/XsdWildcard.cs

index 88066c24529c5488f45442354e4f1c3d976f9d03..b8a43815cf1fea5f19156838f110d9c9659b1920 100644 (file)
@@ -1,3 +1,12 @@
+2003-10-23  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+       * XsdParticleValidationState.cs : Default content processing shoule be
+         lax.
+       * XsdValidatingReader.cs : If there is no trial to get schemas for
+         namespaces, then validation against such namespace should be failed.
+         It now uses XmlSchemaAttribute.ValidatedUse instead of .Use.
+       * XsdWildcard.cs : Fixed incorrect intersection computing.
+
 2003-10-21  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
 
        * XsdKeyTable.cs : Reduced compilation warning.
index 92b16531c99c15debccb2c56f21e3a925fdbe414..58b42c5107a73fa796fc7821328f19bca714d166 100644 (file)
@@ -31,7 +31,7 @@ namespace Mono.Xml.Schema
                public XsdValidationStateManager ()
                {
                        table = new Hashtable ();
-                       processContents = XmlSchemaContentProcessing.Strict;
+                       processContents = XmlSchemaContentProcessing.Lax;
                }
 
                public XmlSchemaElement CurrentElement {
index 21d3106ac04a3be12f8bdd8f1240209eb9366a1a..562174bd4ec704fabd8230d2ef85657a1806e7b6 100644 (file)
@@ -782,7 +782,7 @@ string each = normalized;
                                        break;
                                default:
                                        XmlSchema schema = schemas [reader.NamespaceURI];
-                                       if (xsiTypeName == null && (schema != null && !schema.missedSubComponents)) {
+                                       if (xsiTypeName == null && (schema == null || !schema.missedSubComponents)) {
                                                HandleError ("Element declaration for " + reader.LocalName + " is missing.");
                                        }
                                        break;
@@ -924,7 +924,7 @@ string each = normalized;
                        // FIXME: FixedValue check maybe extraneous.
                        foreach (XmlSchemaAttribute attr in cType.AttributeUses) {
                                if (reader [attr.QualifiedName.Name, attr.QualifiedName.Namespace] == null) {
-                                       if (attr.Use == XmlSchemaUse.Required && 
+                                       if (attr.ValidatedUse == XmlSchemaUse.Required && 
                                                attr.ValidatedFixedValue == null)
                                                HandleError ("Required attribute " + attr.QualifiedName + " was not found.");
                                        else if (attr.ValidatedDefaultValue != null)
@@ -1063,7 +1063,7 @@ string each = normalized;
                {
                        // TODO: value constraint check
                        // This is extra check than spec 3.5.4
-                       if (attr.Use == XmlSchemaUse.Prohibited)
+                       if (attr.ValidatedUse == XmlSchemaUse.Prohibited)
                                HandleError ("Attribute " + attr.QualifiedName + " is prohibited in this context.");
                }
 
index 0a96e4a27cf0d5edfbdfd6d1c45136c6911a5f12..aa084e18757c2941fb447960f917d79edb2020c6 100644 (file)
@@ -88,7 +88,7 @@ namespace Mono.Xml.Schema
 \r
                // 3.8.6. Attribute Wildcard Intersection\r
                // Only try to examine if their intersection is expressible, and\r
-               // returns if the result is empty.\r
+               // returns true if the result is empty.\r
                public bool ExamineAttributeWildcardIntersection (XmlSchemaAny other,\r
                        ValidationEventHandler h, XmlSchema schema)\r
                {\r
@@ -120,21 +120,25 @@ namespace Mono.Xml.Schema
                                        !this.HasValueTargetNamespace &&\r
                                        this.ResolvedNamespaces.Count == 0;\r
                        // 5.\r
-                       if (this.HasValueOther && other.HasValueOther) {\r
-                               xsobj.error (h, "The Wildcard intersection is not expressible.");\r
+                       if (this.HasValueOther && other.HasValueOther && this.TargetNamespace != other.TargetNamespace) {\r
+//                             xsobj.error (h, "The Wildcard intersection is not expressible.");\r
                                return false;\r
                        }\r
                        // 3.\r
-                       if (this.HasValueOther && !other.HasValueOther)\r
-                               return !other.HasValueLocal &&\r
-                                       (other.ResolvedNamespaces.Count == 0 ||\r
-                                       other.ResolvedNamespaces.Count == 1 && other.ResolvedNamespaces.Contains (other.TargetNamespace)) &&\r
-                                       !other.ValidateWildcardAllowsNamespaceName (this.TargetNamespace, h, schema, false);\r
-                       if (!this.HasValueOther && other.HasValueOther)\r
-                               return !this.HasValueLocal &&\r
-                                       (this.ResolvedNamespaces.Count == 0 ||\r
-                                       this.ResolvedNamespaces.Count == 1 && this.ResolvedNamespaces.Contains (other.TargetNamespace)) &&\r
-                                       !this.ValidateWildcardAllowsNamespaceName (other.TargetNamespace, h, schema, false);\r
+                       if (this.HasValueOther) {\r
+                               if (other.HasValueLocal && this.TargetNamespace != String.Empty)\r
+                                       return false;\r
+                               if (other.HasValueTargetNamespace && this.TargetNamespace != other.TargetNamespace)\r
+                                       return false;\r
+                               return other.ValidateWildcardAllowsNamespaceName (this.TargetNamespace, h, schema, false);\r
+                       }\r
+                       if (other.HasValueOther) {\r
+                               if (this.HasValueLocal && other.TargetNamespace != String.Empty)\r
+                                       return false;\r
+                               if (this.HasValueTargetNamespace && other.TargetNamespace != this.TargetNamespace)\r
+                                       return false;\r
+                               return this.ValidateWildcardAllowsNamespaceName (other.TargetNamespace, h, schema, false);\r
+                       }\r
                        // 4.\r
                        if (this.ResolvedNamespaces.Count > 0) {\r
                                foreach (string ns in this.ResolvedNamespaces)\r
@@ -165,44 +169,49 @@ namespace Mono.Xml.Schema
                }\r
 \r
                // 3.10.6 Wildcard Subset\r
-               internal void ValidateWildcardSubset (XmlSchemaAnyAttribute other,\r
+               // Other = wider. this = restricted subset\r
+               internal void ValidateWildcardSubset (XsdWildcard other,\r
                        ValidationEventHandler h, XmlSchema schema)\r
                {\r
                        // 1.\r
-                       if (HasValueAny)\r
+                       if (other.HasValueAny)\r
                                return;\r
-                       if (HasValueOther) {\r
-                               if (other.HasValueOther) {\r
+                       if (HasValueOther && other.HasValueOther) {\r
                                        // 2.1 and 2.2\r
                                        if (TargetNamespace == other.TargetNamespace ||\r
                                                other.TargetNamespace == null || other.TargetNamespace == "")\r
                                                return;\r
-                               }\r
+                       }\r
+                       // 3.1.\r
+                       if (this.HasValueAny)\r
+                               xsobj.error (h, "Invalid wildcard subset was found.");\r
+                       // 3.2\r
+                       if (other.HasValueOther) {\r
                                // 3.2.2\r
-                               else if (TargetNamespace == null || TargetNamespace == String.Empty)\r
+                               if (other.TargetNamespace == null || other.TargetNamespace == String.Empty)\r
                                        return;\r
                                else {\r
-                                       foreach (string ns in other.ResolvedNamespaces)\r
-                                               if (ns == this.TargetNamespace) {\r
+                                       foreach (string ns in ResolvedNamespaces)\r
+                                               if (ns == other.TargetNamespace) {\r
                                                        xsobj.error (h, "Invalid wildcard subset was found.");\r
                                                        return;\r
                                                }\r
                                }\r
                        } else {\r
-                               // 3.1\r
-                               if (!HasValueLocal && other.HasValueLocal) {\r
+                               // 3.2.1\r
+                               if (!other.HasValueLocal && HasValueLocal) {\r
                                        xsobj.error (h, "Invalid wildcard subset was found.");\r
-                               } else if (other.ResolvedNamespaces.Count == 0)\r
                                        return;\r
-                               else {\r
-                                       foreach (string ns in other.ResolvedNamespaces)\r
-                                               if (!this.ResolvedNamespaces.Contains (ns)) {\r
+                               } else if (ResolvedNamespaces.Count == 0) {\r
+                                       return;\r
+                               } else {\r
+                                       foreach (string ns in ResolvedNamespaces)\r
+                                               if (!other.ResolvedNamespaces.Contains (ns)) {\r
                                                        xsobj.error (h, "Invalid wildcard subset was found.");\r
                                                        return;\r
                                                }\r
                                }\r
                        }\r
                }\r
-\r
        }\r
 }\r