diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2007-04-24 16:40:40 +0400 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2007-04-24 16:40:40 +0400 |
commit | 020846512357e8c6a24d4e1f68d655c3924f2ca2 (patch) | |
tree | 46262b0b3bfa5466ff41858472316bda31edebf2 /mcs/class/System.XML/System.Xml.Schema | |
parent | e8d592a899172a0f3801b18e7e14c82da6bdffb8 (diff) |
2007-04-24 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchema.cs XmlSchemaGroup.cs XmlSchemaAny.cs XmlSchemaElement.cs
XmlSchemaNotation.cs XmlSchemaComplexType.cs
XmlSchemaAttributeGroup.cs XmlSchemaSimpleType.cs
XmlSchemaIdentityConstraint.cs XmlSchemaAnyAttribute.cs
XmlSchemaRedefine.cs XmlSchemaAttribute.cs :
avoid incorrect compilation of included schemas, fixed bug #81360.
more fix for wrong targetNamespace propagation within current
processing model. Replaced ParentIsSchema field with a property.
* XsdValidatingReaderTests.cs : added test for bug #81360.
* 81360.xsd, 81360inc1.xsd, 81360inc2.xsd : new test files.
* Makefile : added distfiles.
svn path=/trunk/mcs/; revision=76184
Diffstat (limited to 'mcs/class/System.XML/System.Xml.Schema')
13 files changed, 44 insertions, 18 deletions
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog index 1525b4e153b..463ced4e5f4 100644 --- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog @@ -1,5 +1,16 @@ 2007-04-24 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchema.cs XmlSchemaGroup.cs XmlSchemaAny.cs XmlSchemaElement.cs + XmlSchemaNotation.cs XmlSchemaComplexType.cs + XmlSchemaAttributeGroup.cs XmlSchemaSimpleType.cs + XmlSchemaIdentityConstraint.cs XmlSchemaAnyAttribute.cs + XmlSchemaRedefine.cs XmlSchemaAttribute.cs : + avoid incorrect compilation of included schemas, fixed bug #81360. + more fix for wrong targetNamespace propagation within current + processing model. Replaced ParentIsSchema field with a property. + +2007-04-24 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchema.cs XmlSchemaSimpleTypeList.cs XmlSchemaComplexContentRestriction.cs XmlSchemaGroup.cs XmlSchemaComplexContentExtension.cs XmlSchemaSequence.cs diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs index b865018ceed..a9d8e74294e 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs @@ -450,9 +450,7 @@ namespace System.Xml.Schema includedSchema.TargetNamespace = TargetNamespace; } - // Compile included schema. - // FIXME: this compilation causes bug #81360 - includedSchema.DoCompile (handler, handledUris, col, resolver); + // Do not compile included schema here. AddExternalComponentsTo (includedSchema, compilationItems); } @@ -469,7 +467,6 @@ namespace System.Xml.Schema errorCount += numerr; } else if (obj is XmlSchemaAttribute) { XmlSchemaAttribute attr = (XmlSchemaAttribute) obj; - attr.ParentIsSchema = true; int numerr = attr.Compile (handler, this); errorCount += numerr; if(numerr == 0) @@ -488,7 +485,6 @@ namespace System.Xml.Schema handler); } else if (obj is XmlSchemaComplexType) { XmlSchemaComplexType ctype = (XmlSchemaComplexType) obj; - ctype.ParentIsSchema = true; int numerr = ctype.Compile (handler, this); errorCount += numerr; if (numerr == 0) diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs index da94bea143a..7d103c1f5ac 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs @@ -132,7 +132,7 @@ namespace System.Xml.Schema errorCount = 0; XmlSchemaUtil.CompileID(Id,this, schema.IDCollection,h); - wildcard.TargetNamespace = schema.TargetNamespace; + wildcard.TargetNamespace = AncestorSchema.TargetNamespace; if (wildcard.TargetNamespace == null) wildcard.TargetNamespace = ""; CompileOccurence (h, schema); diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs index fcd98501d56..c208b88ef00 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs @@ -111,7 +111,7 @@ namespace System.Xml.Schema errorCount = 0; - wildcard.TargetNamespace = schema.TargetNamespace; + wildcard.TargetNamespace = AncestorSchema.TargetNamespace; if (wildcard.TargetNamespace == null) wildcard.TargetNamespace = ""; diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs index f144bd1a548..e09b891a1b5 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs @@ -57,7 +57,9 @@ namespace System.Xml.Schema private XmlSchemaUse use; private XmlSchemaUse validatedUse; //Compilation fields - internal bool ParentIsSchema = false; + internal bool ParentIsSchema { + get { return Parent is XmlSchema; } + } private XmlSchemaAttribute referencedAttribute; const string xmlname = "attribute"; @@ -284,7 +286,7 @@ namespace System.Xml.Schema if(RefName == null || RefName.IsEmpty) { if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && schema.AttributeFormDefault == XmlSchemaForm.Qualified)) - this.targetNamespace = schema.TargetNamespace; + this.targetNamespace = AncestorSchema.TargetNamespace; else this.targetNamespace = ""; @@ -341,7 +343,7 @@ namespace System.Xml.Schema qualifiedName = RefName; } - if(schema.TargetNamespace == XmlSchema.InstanceNamespace && Name != "nil" && Name != "type" + if(AncestorSchema.TargetNamespace == XmlSchema.InstanceNamespace && Name != "nil" && Name != "type" && Name != "schemaLocation" && Name != "noNamespaceSchemaLocation") // a.15, a.16 error(h,"targetNamespace can't be " + XmlSchema.InstanceNamespace); @@ -463,6 +465,18 @@ namespace System.Xml.Schema return errorCount; } + internal bool AttributeEquals (XmlSchemaAttribute other) + { + if (Id != other.Id || + QualifiedName != other.QualifiedName || + AttributeType != other.AttributeType || + ValidatedUse != other.ValidatedUse || + ValidatedDefaultValue != other.ValidatedDefaultValue || + ValidatedFixedValue != other.ValidatedFixedValue) + return false; + return true; + } + //<attribute // default = string // fixed = string diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs index eb0c251d842..5922b8c1e90 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs @@ -137,7 +137,7 @@ namespace System.Xml.Schema else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2 error(h,"name attribute of a simpleType must be NCName"); else - this.qualifiedName = new XmlQualifiedName(this.Name, schema.TargetNamespace); + this.qualifiedName = new XmlQualifiedName(this.Name, AncestorSchema.TargetNamespace); if(this.AnyAttribute != null) { diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs index f2094f72a28..a44bfe60a35 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs @@ -54,7 +54,9 @@ namespace System.Xml.Schema private XmlSchemaContentType resolvedContentType; internal bool ValidatedIsAbstract; - internal bool ParentIsSchema = false; + internal bool ParentIsSchema { + get { return Parent is XmlSchema; } + } const string xmlname = "complexType"; diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs index e1cd211d9c1..9c80dd35872 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs @@ -453,7 +453,7 @@ namespace System.Xml.Schema string targetNamespace = String.Empty; if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && schema.ElementFormDefault == XmlSchemaForm.Qualified)) - targetNamespace = schema.TargetNamespace; + targetNamespace = AncestorSchema.TargetNamespace; if(this.name == null) //b1 error(h,"Required attribute name must be present"); diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs index 8782eb17ddb..ebbfaa2d306 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs @@ -101,7 +101,7 @@ namespace System.Xml.Schema else if(!XmlSchemaUtil.CheckNCName(this.name)) error(h,"attribute name must be NCName"); else - qualifiedName = new XmlQualifiedName(Name,schema.TargetNamespace); + qualifiedName = new XmlQualifiedName(Name, AncestorSchema.TargetNamespace); if(Particle == null) { diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs index b871a283c1e..9db41b23c4c 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs @@ -102,7 +102,7 @@ namespace System.Xml.Schema else if(!XmlSchemaUtil.CheckNCName(this.name)) error(h,"attribute name must be NCName"); else { - this.qName = new XmlQualifiedName(Name,schema.TargetNamespace); + this.qName = new XmlQualifiedName(Name, AncestorSchema.TargetNamespace); if (schema.NamedIdentities.Contains (qName)) { XmlSchemaIdentityConstraint existing = schema.NamedIdentities [qName] as XmlSchemaIdentityConstraint; diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs index 9198c20afc1..f5b8ab363df 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs @@ -79,7 +79,7 @@ namespace System.Xml.Schema else if(!XmlSchemaUtil.CheckNCName(this.name)) error(h,"attribute name must be NCName"); else - qualifiedName = new XmlQualifiedName(Name,schema.TargetNamespace); + qualifiedName = new XmlQualifiedName(Name, AncestorSchema.TargetNamespace); if(Public==null) error(h,"public must be present"); diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs index af1a8d39a02..85b5e5a0b30 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs @@ -78,8 +78,11 @@ namespace System.Xml.Schema internal override void SetParent (XmlSchemaObject parent) { base.SetParent (parent); - foreach (XmlSchemaObject i in Items) + foreach (XmlSchemaObject i in Items) { i.SetParent (this); + i.isRedefinedComponent = true; + i.isRedefineChild = true; + } } //<redefine diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs index fe028cea0de..4892a2887b7 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs @@ -277,7 +277,7 @@ namespace System.Xml.Schema else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2 error(h,"name attribute of a simpleType must be NCName"); else - this.QNameInternal = new XmlQualifiedName(this.Name,schema.TargetNamespace); + this.QNameInternal = new XmlQualifiedName(this.Name, AncestorSchema.TargetNamespace); //NOTE: Although the FinalResolved can be Empty, it is not a valid value for Final //DEVIATION: If an error occurs, the finaldefault is always consulted. This deviates |