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;
// 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)
{
// 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.");
}
\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
!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
}\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