diff options
author | Atsushi Eno <atsushieno@gmail.com> | 2005-12-01 09:16:29 +0300 |
---|---|---|
committer | Atsushi Eno <atsushieno@gmail.com> | 2005-12-01 09:16:29 +0300 |
commit | e4febe6edec226f5f46daad33583a92e4edb9758 (patch) | |
tree | 770d2d04dcbc4832abdaaa04eadd49ef4e98f8b1 /mcs/class/System.XML | |
parent | 906d303f7592c7fd8fd6bca6910b63edf8a1822a (diff) |
2005-12-01 Atsushi Enomoto <atsushi@ximian.com>
* XmlSchemaSequence.cs : when a subcomponent is not optional
(minOccurs!=0) then it should clean previous components up.
Really fixed bug #76865.
* XmlSchemaTests.cs :
Additional schema component to finish #76865 test.
* Makefile : Use MONO_PATH. Remove extraneous make variables.
svn path=/trunk/mcs/; revision=53748
Diffstat (limited to 'mcs/class/System.XML')
6 files changed, 64 insertions, 13 deletions
diff --git a/mcs/class/System.XML/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/System.Xml.Schema/ChangeLog index 39ab52fb8ac..994533aa5be 100644 --- a/mcs/class/System.XML/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/System.Xml.Schema/ChangeLog @@ -1,5 +1,11 @@ 2005-12-01 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaSequence.cs : when a subcomponent is not optional + (minOccurs!=0) then it should clean previous components up. + Really fixed bug #76865. + +2005-12-01 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaElement.cs : Fixed ambiguity detection logic so that chameleon ##other (xs:any) does not block other "absent" (empty targetNamespace) element. Fixed bug #76865. diff --git a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs index af9ea7c8684..acf455c708d 100644 --- a/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs +++ b/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs @@ -227,19 +227,47 @@ namespace System.Xml.Schema internal override void ValidateUniqueParticleAttribution (XmlSchemaObjectTable qnames, ArrayList nsNames,
ValidationEventHandler h, XmlSchema schema)
{
+ ValidateUPAOnHeadingOptionalComponents (qnames, nsNames, h, schema);
+ ValidateUPAOnItems (qnames, nsNames, h, schema);
+ }
+
+ void ValidateUPAOnHeadingOptionalComponents (XmlSchemaObjectTable qnames, ArrayList nsNames,
+ ValidationEventHandler h, XmlSchema schema)
+ {
+ // heading optional components
foreach (XmlSchemaParticle p in this.Items) {
p.ValidateUniqueParticleAttribution (qnames, nsNames, h, schema);
- if (p.ValidatedMinOccurs == p.ValidatedMaxOccurs)
+ if (p.ValidatedMinOccurs != 0)
break;
}
- XmlSchemaObjectTable tmpTable = new XmlSchemaObjectTable ();
- ArrayList al = new ArrayList ();
+ }
+
+ void ValidateUPAOnItems (XmlSchemaObjectTable qnames, ArrayList nsNames,
+ ValidationEventHandler h, XmlSchema schema)
+ {
+ // non-optional components
+ XmlSchemaObjectTable elems = new XmlSchemaObjectTable ();
+ ArrayList wildcards = new ArrayList ();
+ XmlSchemaObjectTable tmpElems = new XmlSchemaObjectTable ();
+ ArrayList tmpWildcards = new ArrayList ();
for (int i=0; i<Items.Count; i++) {
XmlSchemaParticle p1 = Items [i] as XmlSchemaParticle;
- p1.ValidateUniqueParticleAttribution (tmpTable, al, h, schema);
+ p1.ValidateUniqueParticleAttribution (elems, wildcards, h, schema);
if (p1.ValidatedMinOccurs == p1.ValidatedMaxOccurs) {
- tmpTable.Clear ();
- al.Clear ();
+ elems.Clear ();
+ wildcards.Clear ();
+ }
+ else {
+ if (p1.ValidatedMinOccurs != 0) {
+ foreach (XmlQualifiedName n in tmpElems.Names)
+ elems.Set (n, null); // remove
+ foreach (object o in tmpWildcards)
+ wildcards.Remove (o);
+ }
+ foreach (XmlQualifiedName n in elems.Names)
+ tmpElems.Set (n, elems [n]);
+ tmpWildcards.Clear ();
+ tmpWildcards.AddRange (wildcards);
}
}
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog index 545dc189a41..a3ec769020c 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml.Schema/ChangeLog @@ -1,5 +1,10 @@ 2005-12-01 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaTests.cs : + Additional schema component to finish #76865 test. + +2005-12-01 Atsushi Enomoto <atsushi@ximian.com> + * XmlSchemaTests.cs : added testcase for #76865. 2005-10-23 Atsushi Enomoto <atsushi@ximian.com> diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs index 3e6c5b24368..cf2e11bf26b 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs +++ b/mcs/class/System.XML/Test/System.Xml.Schema/XmlSchemaTests.cs @@ -306,9 +306,18 @@ namespace MonoTests.System.Xml } [Test] + // bug #76865 public void AmbiguityDetectionOnChameleonAnyOther () { - string xsd = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> <xs:complexType name='TestType'> <xs:sequence> <xs:any namespace='##other' minOccurs='0' /> <xs:element name='Item' /> </xs:sequence> </xs:complexType></xs:schema>"; + string xsd = @"<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'> +<xs:complexType name='TestType'> + <xs:sequence> + <xs:any namespace='##other' minOccurs='0' /> + <xs:element name='Item' /> + <xs:any namespace='##other' minOccurs='0' /> + </xs:sequence> +</xs:complexType> +</xs:schema>"; XmlSchema.Read (new XmlTextReader (xsd, XmlNodeType.Document, null), null); } } diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog index 0812196f3d8..332221666ab 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog +++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/ChangeLog @@ -1,3 +1,7 @@ +2005-12-01 Atsushi Enomoto <atsushi@ximian.com> + + * Makefile : Use MONO_PATH. Remove extraneous make variables. + 2005-11-07 Atsushi Enomoto <atsushi@ximian.com> * xsdtest.cs : updated to match 2.0 RTM API. diff --git a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile index f7da7143a56..3abfacfef0e 100644 --- a/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile +++ b/mcs/class/System.XML/Test/System.Xml.Schema/standalone_tests/Makefile @@ -1,5 +1,4 @@ -RUNTIME = mono --debug -MCS_RUNTIME = +RUNTIME = MONO_PATH=../../../../lib/default mono --debug MCS = mcs TESTS = xsd-test-suite/suntest/SunTestsAll/xsiType1.xsd MASTERS = xsd-test-suite/suntest/tests-all.xml @@ -7,10 +6,10 @@ TEST_ARCHIVE = XSTC-20020116.tar.gz MASTER_ARCHIVE = test-masters.tar.gz xsdtest.exe : xsdtest.cs $(TESTS) - $(MCS_RUNTIME) $(MCS) xsdtest.cs + $(MCS) xsdtest.cs xs-psci-compare.exe : xs-psci-compare.cs - $(MCS_RUNTIME) $(MCS) xs-psci-compare.cs + $(MCS) xs-psci-compare.cs $(MASTERS) : $(MASTER_ARCHIVE) mkdir xsd-test-suite 2>/dev/null; true @@ -26,11 +25,11 @@ $(TEST_ARCHIVE) : wget http://www.w3.org/2001/05/xmlschema-test-collection/XSTC-20020116.tar.gz run-test : - $(RUNTIME) $(RUNTIME_FLAGS) xsdtest.exe --xml --reportsuccess --testall --details --report:TestResult.xml $(XSD_TEST_FLAGS) + $(RUNTIME) xsdtest.exe --xml --reportsuccess --testall --details --report:TestResult.xml $(XSD_TEST_FLAGS) @echo "SUCCESS: `grep -c \"OK\" TestResult.xml` NORMAL FAILURE: `grep -c should TestResult.xml` UNEXPECTED `grep -c unexpected TestResult.xml`" test-psci : xs-psci-compare.exe - $(RUNTIME) $(RUNTIME_FLAGS) xs-psci-compare.exe xsd-test-suite/msxsdtest/tests-all.xml > psci-mono-msxsd.txt + $(RUNTIME) xs-psci-compare.exe xsd-test-suite/msxsdtest/tests-all.xml > psci-mono-msxsd.txt # be careful to use it. This removes ALL files in xsd-test-suite! # clean: |