2002-06-14 Dwivedi, Ajay kumar <adwiv@yahoo.com>
authorAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>
Fri, 14 Jun 2002 10:42:02 +0000 (10:42 -0000)
committerAjay kumar Dwivedi <ajay@mono-cvs.ximian.com>
Fri, 14 Jun 2002 10:42:02 +0000 (10:42 -0000)
* General: Fixed a few more Bugs

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

53 files changed:
mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt [new file with mode: 0755]
mcs/class/System.XML/System.Xml.Schema/BUGS.txt
mcs/class/System.XML/System.Xml.Schema/ChangeLog
mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAll.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnnotation.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAny.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAnyAttribute.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttribute.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroup.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaAttributeGroupRef.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaChoice.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContent.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentExtension.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexContentRestriction.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaComplexType.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaDocumentation.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaEnumerationFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaFractionDigitsFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroup.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaGroupRef.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaImport.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaInclude.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaInfo.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaKey.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaKeyref.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaLengthFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxExclusiveFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxInclusiveFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMaxLengthFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinExclusiveFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinInclusiveFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaMinLengthFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaNotation.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaObject.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaParticle.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaPatternFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaRedefine.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSequence.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContent.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentExtension.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleContentRestriction.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleType.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeList.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeRestriction.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaSimpleTypeUnion.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaTotalDigitsFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaUnique.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaUtil.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaWhiteSpaceFacet.cs
mcs/class/System.XML/System.Xml.Schema/XmlSchemaXPath.cs

diff --git a/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt b/mcs/class/System.XML/System.Xml.Schema/BUGS-MS.txt
new file mode 100755 (executable)
index 0000000..ad4ece9
--- /dev/null
@@ -0,0 +1,20 @@
+BUGS in MS Implementation of XmlSchema:\r
+\r
+1. Does not allow duplicate values in lists for final* and block* attributes. \r
+   For example "restriction restriction" is not allowed even though its a valid\r
+   value for blockDefault.\r
+\r
+2. Resets the minOccurs to 0 if maxOccurs="0", whereas it should raise an error.\r
+\r
+3. Allows abstract="true" in the a localElement whereas it is not allowed.\r
+       <?xml version="1.0"?>\r
+       <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">\r
+               <xsd:element name="doc">\r
+                       <xsd:complexType>\r
+                               <xsd:sequence>\r
+                                       <xsd:element name="elem1"/>\r
+                                       <xsd:element abstract="true" name="elem2"/> <!--This element is not valid -->\r
+                               </xsd:sequence>\r
+                       </xsd:complexType>\r
+               </xsd:element>\r
+       </xsd:schema>
\ No newline at end of file
index d2d08d49112f9fa612685c1070c631ccf66139c1..20d1904157a4da23bf13af4894883fe87fb873b1 100755 (executable)
@@ -1,5 +1,5 @@
 Bugs in Implementation:\r
 \r
-1. Not all Compile methods check for the Id attribute. Trivial but needs to be done.\r
-2. None of the XmlSchemaObjects except the XmlSchema populate XmlSerializerNamespaces.\r
-3. Non schema attributes are not being handled. Need an internal XmlAttribute constructor.\r
+// None of the XmlSchemaObjects except the XmlSchema populate XmlSerializerNamespaces.\r
+2. Non schema attributes are not being handled. Need an internal XmlAttribute constructor.\r
+3. Documentation and appInfo's Markup is not being read in the Read() Method.\r
index 2af9114a78baf72f617ffc48c23301fa162068d4..797baf7f038cc44ba494ce7fcad2d2d198180aa7 100755 (executable)
@@ -1,3 +1,6 @@
+2002-06-14  Dwivedi, Ajay kumar <adwiv@yahoo.com>
+       * General: Fixed a few more Bugs
+
 2002-06-10  Dwivedi, Ajay kumar <adwiv@yahoo.com>
        * XmlSchemaReader: A Wrapper class around XmlReader with customized
          methods to suit reading a schema.
index 650a34ae3522767217655714d7a138875a1dc84b..9bc9b65bfaab29a88d093b6a765de583b5aa42b3 100755 (executable)
@@ -208,62 +208,72 @@ namespace System.Xml.Schema
                ///             2. finalDefault must be one of (#all | List of (extension | restriction| union| list))\r
                ///             3. id must be of type ID\r
                ///             4. targetNamespace should be any uri\r
-               ///             5. version should be a token\r
+               ///             5. version should be a normalizedString\r
                ///             6. xml:lang should be a language\r
-               ///             \r
                /// </remarks>\r
                [MonoTODO]\r
                public void Compile(ValidationEventHandler handler)\r
                {\r
+                       // Create the xmlschemainfo object which we use to pass variables like targetnamespace;\r
+                       info = new XmlSchemaInfo();\r
+\r
                        //1. Union and List are not allowed in block default\r
-                       if(this.blockDefault != XmlSchemaDerivationMethod.All)\r
+                       if(BlockDefault != XmlSchemaDerivationMethod.All)\r
                        {\r
-                               if((this.blockDefault & XmlSchemaDerivationMethod.List)!=0 )\r
+                               if((BlockDefault & XmlSchemaDerivationMethod.List)!=0 )\r
                                        error(handler, "list is not allowed in blockDefault attribute");\r
-                               if((this.blockDefault & XmlSchemaDerivationMethod.Union)!=0 )\r
+                               if((BlockDefault & XmlSchemaDerivationMethod.Union)!=0 )\r
                                        error(handler, "union is not allowed in blockDefault attribute");\r
                        }\r
+\r
                        //2. Substitution is not allowed in finaldefault.\r
-                       if(this.finalDefault != XmlSchemaDerivationMethod.All)\r
+                       if(FinalDefault != XmlSchemaDerivationMethod.All)\r
                        {\r
-                               if((this.finalDefault & XmlSchemaDerivationMethod.Substitution)!=0 )\r
+                               if((FinalDefault & XmlSchemaDerivationMethod.Substitution)!=0 )\r
                                        error(handler, "substitution is not allowed in finalDefault attribute");\r
                        }\r
+\r
                        //3. id must be of type ID\r
-                       if(this.id != null && !XmlSchemaUtil.CheckID(this.id))\r
-                               error(handler, "id attribute is not a valid ID");\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, handler);\r
 \r
-                       //4. targetNamespace should be of type anyURI\r
-                       if(!XmlSchemaUtil.CheckAnyUri(this.targetNamespace))\r
-                               error(handler, "targetNamespace is not a valid URI");\r
+                       //4. targetNamespace should be of type anyURI or absent\r
+                       if(TargetNamespace != null)\r
+                       {\r
+                               if(!XmlSchemaUtil.CheckAnyUri(TargetNamespace))\r
+                                       error(handler, TargetNamespace+" is not a valid value for targetNamespace attribute of schema");\r
+                               else\r
+                                       info.TargetNamespace = TargetNamespace;\r
+                       }\r
 \r
-                       //5. version should be of type TOKEN\r
-                       if(!XmlSchemaUtil.CheckToken(this.version))\r
-                               error(handler, "version is not a valid token");\r
+                       //5. version should be of type normalizedString\r
+                       if(!XmlSchemaUtil.CheckNormalizedString(Version))\r
+                               error(handler, Version + "is not a valid value for version attribute of schema");\r
 \r
                        //6. xml:lang must be a language\r
-                       if(!XmlSchemaUtil.CheckLanguage(this.language))\r
-                               error(handler, "xml:lang is not a valid language");\r
+                       if(!XmlSchemaUtil.CheckLanguage(Language))\r
+                               error(handler, Language + " is not a valid language");\r
 \r
-                       // Create the xmlschemainfo object which we use to pass variables like targetnamespace;\r
-                       info = new XmlSchemaInfo();\r
-                       if(this.targetNamespace != null && XmlSchemaUtil.CheckAnyUri(this.targetNamespace))\r
-                               info.targetNS = this.TargetNamespace;\r
-                       \r
-                       if(this.ElementFormDefault != XmlSchemaForm.Qualified)\r
-                               info.formDefault = XmlSchemaForm.Unqualified;\r
+                       // elementFormDefault defaults to UnQualified\r
+                       if(ElementFormDefault != XmlSchemaForm.Qualified)\r
+                               info.ElementFormDefault = XmlSchemaForm.Unqualified;\r
                        else\r
-                               info.formDefault = XmlSchemaForm.Qualified;\r
+                               info.ElementFormDefault = XmlSchemaForm.Qualified;\r
+\r
+                       // attributeFormDefault defaults to UnQualified\r
+                       if(AttributeFormDefault != XmlSchemaForm.Qualified)\r
+                               info.AttributeFormDefault = XmlSchemaForm.Unqualified;\r
+                       else\r
+                               info.AttributeFormDefault = XmlSchemaForm.Qualified;\r
 \r
                        if(FinalDefault == XmlSchemaDerivationMethod.All)\r
-                               info.finalDefault = XmlSchemaDerivationMethod.All;\r
+                               info.FinalDefault = XmlSchemaDerivationMethod.All;\r
                        else // If finalDefault is None, info's finalDefault is set to empty\r
-                               info.finalDefault = (FinalDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction));\r
+                               info.FinalDefault = (FinalDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction));\r
 \r
                        if(BlockDefault == XmlSchemaDerivationMethod.All)\r
-                               info.blockDefault = XmlSchemaDerivationMethod.All;\r
+                               info.BlockDefault = XmlSchemaDerivationMethod.All;\r
                        else // If finalDefault is None, info's blockDefault is set to empty\r
-                               info.blockDefault = (blockDefault & (XmlSchemaDerivationMethod.Extension |\r
+                               info.BlockDefault = (blockDefault & (XmlSchemaDerivationMethod.Extension |\r
                                                                        XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution));\r
 \r
                        // Compile the content of this schema\r
@@ -275,14 +285,16 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
-                                       error(handler,"Object of Type "+obj.GetType().Name+" is not valid in Includes Property of Schema");\r
+                                       error(handler,"Object of Type "+obj.GetType().Name+" is not valid in Includes Property of XmlSchema");\r
                                }\r
                        }\r
                        foreach(XmlSchemaObject obj in Items)\r
                        {\r
                                if(obj is XmlSchemaAnnotation)\r
                                {\r
-                                       if(((XmlSchemaAnnotation)obj).Compile(handler,info) == 0)\r
+                                       int numerr = ((XmlSchemaAnnotation)obj).Compile(handler,info);\r
+                                       errorCount += numerr;\r
+                                       if( numerr == 0)\r
                                        {\r
                                                //FIXME: What PSVI set do we add this to?\r
                                        }\r
@@ -291,7 +303,9 @@ namespace System.Xml.Schema
                                {\r
                                        XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;\r
                                        attr.parentIsSchema = true;\r
-                                       if(attr.Compile(handler,info) == 0)\r
+                                       int numerr = attr.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                Attributes.Add(attr.QualifiedName, attr);\r
                                        }\r
@@ -299,7 +313,9 @@ namespace System.Xml.Schema
                                else if(obj is XmlSchemaAttributeGroup)\r
                                {\r
                                        XmlSchemaAttributeGroup attrgrp = (XmlSchemaAttributeGroup) obj;\r
-                                       if(attrgrp.Compile(handler,info) == 0)\r
+                                       int numerr = attrgrp.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                AttributeGroups.Add(attrgrp.QualifiedName, attrgrp);\r
                                        }\r
@@ -308,7 +324,9 @@ namespace System.Xml.Schema
                                {\r
                                        XmlSchemaComplexType ctype = (XmlSchemaComplexType) obj;\r
                                        ctype.istoplevel = true;\r
-                                       if(ctype.Compile(handler,info) == 0)\r
+                                       int numerr = ctype.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                schemaTypes.Add(ctype.QualifiedName, ctype);\r
                                        }\r
@@ -317,7 +335,9 @@ namespace System.Xml.Schema
                                {\r
                                        XmlSchemaSimpleType stype = (XmlSchemaSimpleType) obj;\r
                                        stype.islocal = false; //This simple type is toplevel\r
-                                       if(stype.Compile(handler,info) == 0)\r
+                                       int numerr = stype.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                SchemaTypes.Add(stype.QualifiedName, stype);\r
                                        }\r
@@ -326,7 +346,9 @@ namespace System.Xml.Schema
                                {\r
                                        XmlSchemaElement elem = (XmlSchemaElement) obj;\r
                                        elem.parentIsSchema = true;\r
-                                       if(elem.Compile(handler,info) == 0)\r
+                                       int numerr = elem.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                Elements.Add(elem.QualifiedName,elem);\r
                                        }\r
@@ -334,7 +356,9 @@ namespace System.Xml.Schema
                                else if(obj is XmlSchemaGroup)\r
                                {\r
                                        XmlSchemaGroup grp = (XmlSchemaGroup) obj;\r
-                                       if(grp.Compile(handler,info) == 0)\r
+                                       int numerr = grp.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                Groups.Add(grp.QualifiedName,grp);\r
                                        }\r
@@ -342,7 +366,9 @@ namespace System.Xml.Schema
                                else if(obj is XmlSchemaNotation)\r
                                {\r
                                        XmlSchemaNotation ntn = (XmlSchemaNotation) obj;\r
-                                       if(ntn.Compile(handler,info) == 0)\r
+                                       int numerr = ntn.Compile(handler,info);\r
+                                       errorCount += numerr;                                   \r
+                                       if(numerr == 0)\r
                                        {\r
                                                Notations.Add(ntn.QualifiedName, ntn);\r
                                        }\r
@@ -362,6 +388,7 @@ namespace System.Xml.Schema
 \r
                        foreach(XmlSchemaObject obj in Includes)\r
                        {\r
+                               \r
                        }\r
 \r
                        //                              foreach(XmlSchemaAnnotation ann in ??????)\r
@@ -408,7 +435,6 @@ namespace System.Xml.Schema
                        return Read(new XmlTextReader(stream),validationEventHandler);\r
                }\r
 \r
-               [MonoTODO]\r
                public static XmlSchema Read(XmlReader rdr, ValidationEventHandler validationEventHandler)\r
                {\r
                        //XmlSerializer xser = new XmlSerializer(typeof(XmlSchema));\r
@@ -665,4 +691,4 @@ namespace System.Xml.Schema
                        writer.Flush();\r
                }\r
        }\r
-}\r
+}
\ No newline at end of file
index ab0ab3fe95c81534582f93b7fd207ff1d715fd53..8a4ff8cba7f3f0f998d8654b89b6ade7ae34ce79 100755 (executable)
@@ -30,25 +30,34 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
+                       //FIXME: Should we reset the values on error??\r
                        if(MaxOccurs != Decimal.One)\r
                                error(h,"maxOccurs must be 1");\r
                        if(MinOccurs != Decimal.One && MinOccurs != Decimal.Zero)\r
                                error(h,"minOccurs must be 0 or 1");\r
 \r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
+\r
                        foreach(XmlSchemaObject obj in Items)\r
                        {\r
                                if(obj is XmlSchemaElement)\r
                                {\r
-                                       errorCount += ((XmlSchemaElement)obj).Compile(h,info);\r
+                                       XmlSchemaElement elem = (XmlSchemaElement)obj;\r
+                                       if(elem.MaxOccurs != Decimal.One && elem.MaxOccurs != Decimal.Zero)\r
+                                       {\r
+                                               elem.error(h,"The {max occurs} of all the elements of 'all' must be 0 or 1. ");\r
+                                       }\r
+                                       errorCount += elem.Compile(h,info);\r
                                }\r
                                else\r
                                {\r
                                        error(h,"XmlSchemaAll can only contain Items of type Element");\r
                                }\r
                        }\r
+\r
                        return errorCount;\r
                }\r
-               \r
+\r
                [MonoTODO]\r
                internal int Validate(ValidationEventHandler h)\r
                {\r
@@ -112,6 +121,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               all.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               all.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index d0a7d7951fb7faa4b6fdc322b1e7b4a870876851..2b2957a7878374c90b4ed983360fb4dd7344da42 100755 (executable)
@@ -44,13 +44,13 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
-                       return 1;\r
+                       return 0;\r
                }\r
                \r
                [MonoTODO]\r
                internal int Validate(ValidationEventHandler h)\r
                {\r
-                       return 1;\r
+                       return 0;\r
                }\r
 \r
                //<annotation\r
@@ -87,7 +87,11 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
-                                       //TODO: Add to Unhandled attributes\r
+                                                                                       if(reader.Prefix == "xmlns")\r
+                                                                                               annotation.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                                                                       else if(reader.Name == "xmlns")\r
+                                                                                               annotation.Namespaces.Add("",reader.Value);\r
+                                               //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
                        \r
index c4d9df19c7f61d230428d9e5fe36dc18a17b82e8..d1523a3f7230befeb62a072769fef3a6753cad9b 100755 (executable)
@@ -46,10 +46,8 @@ namespace System.Xml.Schema
                {\r
                        errorCount = 0;\r
 \r
-                       if(Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                       {\r
-                               error(h, "id attribute must be a valid ID");\r
-                       }\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        //define ##any=1,##other=2,##targetNamespace=4,##local=8,anyURI=16\r
                        int nscount = 0;\r
                        string[] nslist = XmlSchemaUtil.SplitList(Namespace);\r
@@ -160,6 +158,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               any.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               any.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 8569c3067a37d16fbaa9b7c9356bfcdd38773861..870952626cfa1186f8f27f1f356cde7204438bef 100755 (executable)
@@ -46,10 +46,8 @@ namespace System.Xml.Schema
                {\r
                        errorCount = 0;\r
 \r
-                       if(Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                       {\r
-                               error(h, "id attribute must be a valid ID");\r
-                       }\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        //define ##any=1,##other=2,##targetNamespace=4,##local=8,anyURI=16\r
                        int nscount = 0;\r
                        string[] nslist = XmlSchemaUtil.SplitList(Namespace);\r
@@ -137,6 +135,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               any.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               any.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 3eee2700749563f1cd7f962b2d396a876480a489..49bd277fae4cd412136b318fc7712693b6e1119e 100755 (executable)
@@ -162,20 +162,19 @@ namespace System.Xml.Schema
                ///     4. If default and use are both present, use must have the Â·actual value· optional.\r
                /// </remarks>\r
                [MonoTODO]\r
-               //FIXME: Should we set a property to null if an error occurs? Or should we stop the validation?\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
                        errorCount = 0;\r
                        \r
                        if(parentIsSchema)//a\r
                        {\r
-                               if(this.refName!= null && !this.refName.IsEmpty) // a.1\r
+                               if(RefName!= null && !RefName.IsEmpty) // a.1\r
                                        error(h,"ref must be absent in the top level <attribute>");\r
                                \r
-                               if(this.form != XmlSchemaForm.None)     // a.2\r
+                               if(Form != XmlSchemaForm.None)  // a.2\r
                                        error(h,"form must be absent in the top level <attribute>");\r
                                \r
-                               if(this.use != XmlSchemaUse.None)               // a.3\r
+                               if(Use != XmlSchemaUse.None)            // a.3\r
                                        error(h,"use must be absent in the top level <attribute>");\r
 \r
                                // TODO: a.10, a.11, a.12, a.13\r
@@ -183,7 +182,8 @@ namespace System.Xml.Schema
                        }\r
                        else // local\r
                        {\r
-                               if(this.refName == null || this.refName.IsEmpty)\r
+                               //FIXME: How to Use of AttributeFormDefault????\r
+                               if(RefName == null || RefName.IsEmpty)\r
                                {\r
                                        //TODO: b.8\r
                                        CompileCommon(h,info, true);\r
@@ -209,44 +209,45 @@ namespace System.Xml.Schema
                {\r
                        if(refIsNotPresent)\r
                        {\r
-                               if(this.name == null)   //a.4, b.1, \r
+                               if(Name == null)        //a.4, b.1, \r
                                        error(h,"Required attribute name must be present");\r
-                               else if(!XmlSchemaUtil.CheckNCName(this.name)) // a.4.2, b1.2\r
+                               else if(!XmlSchemaUtil.CheckNCName(Name)) // a.4.2, b1.2\r
                                        error(h,"attribute name must be NCName");\r
-                               else if(this.name == "xmlns") // a.14 , b5\r
-                                       error(h,"attribute name can't be xmlns");\r
+                               else if(Name == "xmlns") // a.14 , b5\r
+                                       error(h,"attribute name must not be xmlns");\r
                                else\r
-                                       this.qualifiedName = new XmlQualifiedName(this.name, info.targetNS);    \r
+                                       qualifiedName = new XmlQualifiedName(Name, info.TargetNamespace);       \r
 \r
-                               if(this.schemaType != null)\r
+                               if(SchemaType != null)\r
                                {\r
-                                       if(this.schemaTypeName != null && !this.SchemaTypeName.IsEmpty) // a.8\r
+                                       if(SchemaTypeName != null && !SchemaTypeName.IsEmpty) // a.8\r
                                                error(h,"attribute can't have both a type and <simpleType> content");\r
-                                       else \r
-                                       {\r
-                                               errorCount += this.schemaType.Compile(h,info); \r
-                                       }\r
+\r
+                                       errorCount += SchemaType.Compile(h,info); \r
                                }\r
+\r
+                               if(SchemaTypeName != null && !XmlSchemaUtil.CheckQName(SchemaTypeName))\r
+                                       error(h,SchemaTypeName+" is not a valid QName");\r
                        }\r
                        else\r
                        {\r
-                               //      redundant since we call function after check\r
-                               //if(this.refName == null || this.refName.IsEmpty) \r
-                               //      error(h,"refname must be present");\r
-                               this.qualifiedName = this.refName;\r
+                               if(RefName == null || RefName.IsEmpty) \r
+                                       error(h,"Error: Should Never Happen. refname must be present");\r
+                               else\r
+                                       qualifiedName = RefName;\r
                        }\r
-                       if(info.targetNS == XmlSchema.InstanceNamespace && this.name != "nil" && this.name != "type" \r
-                               && this.name != "schemaLocation" && this.name != "noNamespaceSchemaLocation") // a.15, a.16\r
+\r
+                       if(info.TargetNamespace == XmlSchema.InstanceNamespace && Name != "nil" && Name != "type" \r
+                               && Name != "schemaLocation" && Name != "noNamespaceSchemaLocation") // a.15, a.16\r
                                error(h,"targetNamespace can't be " + XmlSchema.InstanceNamespace);\r
 \r
-                       if(this.defaultValue != null && this.fixedValue != null) // a.6, b.3, c.3\r
+                       if(DefaultValue != null && FixedValue != null) // a.6, b.3, c.3\r
                                error(h,"default and fixed must not both be present in an Attribute");\r
 \r
-                       if(this.defaultValue != null && this.use != XmlSchemaUse.None && this.use != XmlSchemaUse.Optional)\r
+                       if(DefaultValue != null && Use != XmlSchemaUse.None && Use != XmlSchemaUse.Optional)\r
                                error(h,"if default is present, use must be optional");\r
-                       \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h,"id attribute must be a valid ID");\r
+\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
                }\r
 \r
                [MonoTODO]\r
@@ -334,6 +335,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               attribute.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               attribute.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 693938d2026210b3ea2bb73a4ee99758a68f8deb..129a3a79917827cf35d1229a7f7bd3678a7c3548 100755 (executable)
@@ -67,12 +67,14 @@ namespace System.Xml.Schema
                {\r
                        errorCount = 0;\r
 \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        if(this.Name == null) //1\r
                                error(h,"Name is required in top level simpletype");\r
                        else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2\r
                                error(h,"name attribute of a simpleType must be NCName");\r
                        else\r
-                               this.qualifiedName = new XmlQualifiedName(this.Name,info.targetNS);\r
+                               this.qualifiedName = new XmlQualifiedName(this.Name,info.TargetNamespace);\r
                        \r
                        if(this.AnyAttribute != null)\r
                        {\r
@@ -144,6 +146,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               attrgrp.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               attrgrp.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 51218d3a5a15094cf473a79173297403af8d4ddb..93a4ebec6e8d3b0ce956b99514dcc950d3f09cb8 100755 (executable)
@@ -33,10 +33,13 @@ namespace System.Xml.Schema
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
                        errorCount = 0;\r
-                       if(this.refName == null || this.refName.IsEmpty)\r
+                       if(RefName == null || RefName.IsEmpty)\r
                                error(h, "ref must be present");\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       else if(!XmlSchemaUtil.CheckQName(RefName))\r
+                               error(h, "ref must be a valid qname");\r
+\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
 //                     if(this.Annotation != null)\r
 //                             error(h, "attributegroup with a ref can't have any content");\r
                        \r
@@ -90,6 +93,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               attrgrp.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               attrgrp.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 7715958f07b84a231f0dc7f8c4929761d46da14f..2edeb5122203c93994d0dd2af8e9400c6e29bcf4 100755 (executable)
@@ -32,6 +32,12 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
+                       //FIXME: Should we reset the values\r
+                       if(MinOccurs > MaxOccurs)\r
+                               error(h,"minOccurs must be less than or equal to maxOccurs");\r
+\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
+\r
                        foreach(XmlSchemaObject obj in Items)\r
                        {\r
                                if(obj is XmlSchemaElement)\r
@@ -120,6 +126,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               choice.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               choice.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 20633c7f00f149e899fc3006c2f98cb3f5b1991a..c11dd9813f80dead8309dcb207a83b1cf59d5ab5 100755 (executable)
@@ -59,8 +59,7 @@ namespace System.Xml.Schema
                                        error(h,"complexContent can't have any value other than restriction or extention");\r
                        }\r
 \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -111,6 +110,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               complex.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               complex.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index b114602ceca1a729eb0bb7d7081f37013081c3fb..8630fc7b52e1a2fa37eba54b6b1293faa98cd01d 100755 (executable)
@@ -63,6 +63,8 @@ namespace System.Xml.Schema
                        {\r
                                error(h, "base must be present and a QName");\r
                        }\r
+                       else if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
+                               error(h,"BaseTypeName is not a valid XmlQualifiedName");\r
                        \r
                        if(this.AnyAttribute != null)\r
                        {\r
@@ -104,9 +106,9 @@ namespace System.Xml.Schema
                                        errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);\r
                                }\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
                        \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        return errorCount;\r
                }\r
                \r
@@ -156,6 +158,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               extension.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               extension.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index b2cc7c5db52bb00f8ed3f59b44d357b1f63c1957..d09f634b1507d58a352497a50ae0429e732c9d8b 100755 (executable)
@@ -64,7 +64,9 @@ namespace System.Xml.Schema
                        {\r
                                error(h, "base must be present and a QName");\r
                        }\r
-                       \r
+                       else if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
+                               error(h,"BaseTypeName is not a valid XmlQualifiedName");\r
+\r
                        if(this.AnyAttribute != null)\r
                        {\r
                                errorCount += AnyAttribute.Compile(h,info);\r
@@ -105,9 +107,9 @@ namespace System.Xml.Schema
                                        errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);\r
                                }\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
                        \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        return errorCount;\r
                }\r
                \r
@@ -158,6 +160,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               restriction.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               restriction.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index c1fb09897a6134c9cf25c491a298dce13ec8a9c4..2627e941e47338da107022a3ec60d3f0fc2c1f27 100755 (executable)
@@ -146,13 +146,11 @@ namespace System.Xml.Schema
                        {\r
                                if(this.Name == null || this.Name == string.Empty)\r
                                        error(h,"name must be present in a top level complex type");\r
+                               else if(!XmlSchemaUtil.CheckNCName(Name))\r
+                                       error(h,"name must be a NCName");\r
                                else\r
-                               {\r
-                                       if(!XmlSchemaUtil.CheckNCName(Name))\r
-                                               error(h,"name must be a NCName");\r
-                                       else\r
-                                               this.qName = new XmlQualifiedName(info.targetNS, Name);\r
-                               }\r
+                                       this.qName = new XmlQualifiedName(Name,info.TargetNamespace);\r
+                               \r
                                if(Block != XmlSchemaDerivationMethod.None)\r
                                {\r
                                        if(Block == XmlSchemaDerivationMethod.All)\r
@@ -167,12 +165,12 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
-                                       if(info.blockDefault == XmlSchemaDerivationMethod.All)\r
+                                       if(info.BlockDefault == XmlSchemaDerivationMethod.All)\r
                                        {\r
                                                blockResolved = XmlSchemaDerivationMethod.All;\r
                                        }\r
                                        else\r
-                                               blockResolved = info.blockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
+                                               blockResolved = info.BlockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
                                }\r
                                if(Final != XmlSchemaDerivationMethod.None)\r
                                {\r
@@ -188,13 +186,13 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
-                                       if(info.finalDefault == XmlSchemaDerivationMethod.All)\r
+                                       if(info.FinalDefault == XmlSchemaDerivationMethod.All)\r
                                        {\r
                                                finalResolved = XmlSchemaDerivationMethod.All;\r
                                        }\r
                                        else\r
                                        {\r
-                                               finalResolved = info.blockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
+                                               finalResolved = info.BlockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
                                        }\r
                                }\r
                        }\r
@@ -258,17 +256,19 @@ namespace System.Xml.Schema
                                        if(obj is XmlSchemaAttribute)\r
                                        {\r
                                                XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;\r
-                                               attr.Compile(h,info);\r
+                                               errorCount += attr.Compile(h,info);\r
                                        }\r
                                        else if(obj is XmlSchemaAttributeGroupRef)\r
                                        {\r
                                                XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;\r
-                                               atgrp.Compile(h,info);\r
+                                               errorCount += atgrp.Compile(h,info);\r
                                        }\r
                                        else\r
                                                error(h,obj.GetType() +" is not valid in this place::ComplexType");\r
                                }\r
                        }\r
+\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
                        return errorCount;\r
                }\r
                \r
@@ -345,6 +345,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               ctype.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               ctype.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 596deb4ffcbc5a8f1c66b97409f735e664c21110..113b7cf09938a105a0033a9b914cf1d859c2364a 100755 (executable)
@@ -17,7 +17,6 @@ namespace System.Xml.Schema
 \r
                public XmlSchemaDocumentation()\r
                {\r
-                       source = string.Empty;\r
                }\r
 \r
                [XmlAnyElement]\r
index 506f8dafdf351f2420c717b53839458bbc0deb5d..30e4198f84dc955527f3cc60c939dd45a1221c21 100755 (executable)
@@ -219,12 +219,13 @@ namespace System.Xml.Schema
                        {\r
                                if(this.refName != null && !RefName.IsEmpty)\r
                                        error(h,"ref must be absent");\r
+\r
                                if(this.name == null)   //b1\r
                                        error(h,"Required attribute name must be present");\r
                                else if(!XmlSchemaUtil.CheckNCName(this.name)) // b1.2\r
                                        error(h,"attribute name must be NCName");\r
                                else\r
-                                       this.qName = new XmlQualifiedName(this.name, info.targetNS);\r
+                                       this.qName = new XmlQualifiedName(this.name, info.TargetNamespace);\r
                                \r
                                if(form != XmlSchemaForm.None)\r
                                        error(h,"form must be absent");\r
@@ -233,56 +234,73 @@ namespace System.Xml.Schema
                                if(MaxOccursString != null)\r
                                        error(h,"maxOccurs must be absent");\r
 \r
+                               XmlSchemaDerivationMethod allfinal = (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
                                if(final == XmlSchemaDerivationMethod.All)\r
-                                       finalResolved = XmlSchemaDerivationMethod.All;\r
+                                       finalResolved = allfinal;\r
                                else if(final == XmlSchemaDerivationMethod.None)\r
-                                       finalResolved = info.blockDefault & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
+                                       finalResolved = info.BlockDefault & allfinal;\r
                                else \r
-                                       finalResolved = final & (XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Restriction);\r
+                               {\r
+                                       if((final & ~allfinal) != 0)\r
+                                               warn(h,"some values for final are invalid in this context");\r
+                                       finalResolved = final & allfinal;\r
+                               }\r
+\r
+                               XmlSchemaDerivationMethod allblock = XmlSchemaDerivationMethod.Extension | \r
+                                       XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution;\r
 \r
                                if(block == XmlSchemaDerivationMethod.All)\r
-                                       blockResolved = XmlSchemaDerivationMethod.All;\r
+                                       blockResolved = allblock;\r
                                else if(block == XmlSchemaDerivationMethod.None)\r
-                                       blockResolved = info.blockDefault & (XmlSchemaDerivationMethod.Extension | \r
-                                               XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution);\r
-                               else \r
-                                       blockResolved = block & (XmlSchemaDerivationMethod.Extension | \r
-                                               XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution);\r
+                                       blockResolved = info.BlockDefault & allblock;\r
+                               else\r
+                               {\r
+                                       if((block & ~allblock) != 0)\r
+                                               warn(h,"Some of the values for block are invalid in this context");\r
+                                       blockResolved = block & allblock;\r
+                               }\r
 \r
                                if(schemaType != null && schemaTypeName != null && !schemaTypeName.IsEmpty)\r
                                {\r
                                        error(h,"both schemaType and content can't be present");\r
                                }\r
-                               else\r
+\r
+                               //Even if both are present, read both of them.\r
+                               if(schemaType != null)\r
                                {\r
-                                       if(schemaType != null)\r
+                                       if(schemaType is XmlSchemaSimpleType)\r
                                        {\r
-                                               if(schemaType is XmlSchemaSimpleType)\r
-                                               {\r
-                                                       errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);\r
-                                               }\r
-                                               else if(schemaType is XmlSchemaComplexType)\r
-                                               {\r
-                                                       errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);\r
-                                               }\r
-                                               else\r
-                                                       error(h,"only simpletype or complextype is allowed");\r
+                                               errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);\r
                                        }\r
-                                       else\r
+                                       else if(schemaType is XmlSchemaComplexType)\r
                                        {\r
-                                               if(schemaTypeName == null || schemaTypeName.IsEmpty)\r
-                                                       error(h,"one of schemaType or schemaTypeName must be present: line 272");\r
+                                               errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);\r
                                        }\r
+                                       else\r
+                                               error(h,"only simpletype or complextype is allowed");\r
+                               }\r
+                               if(schemaTypeName != null && !schemaTypeName.IsEmpty)\r
+                               {\r
+                                       if(!XmlSchemaUtil.CheckQName(SchemaTypeName))\r
+                                               error(h,"SchemaTypeName must be an XmlQualifiedName");\r
+                               }\r
+                               if(SubstitutionGroup != null && !SubstitutionGroup.IsEmpty)\r
+                               {\r
+                                       if(!XmlSchemaUtil.CheckQName(SubstitutionGroup))\r
+                                               error(h,"SubstitutionGroup must be a valid XmlQualifiedName");\r
                                }\r
+\r
                                foreach(XmlSchemaObject obj in constraints)\r
                                {\r
                                        if(obj is XmlSchemaUnique)\r
-                                               ((XmlSchemaUnique)obj).Compile(h,info);\r
+                                               errorCount += ((XmlSchemaUnique)obj).Compile(h,info);\r
                                        else if(obj is XmlSchemaKey)\r
-                                               ((XmlSchemaKey)obj).Compile(h,info);\r
+                                               errorCount += ((XmlSchemaKey)obj).Compile(h,info);\r
                                        else if(obj is XmlSchemaKeyref)\r
-                                               ((XmlSchemaKeyref)obj).Compile(h,info);\r
+                                               errorCount += ((XmlSchemaKeyref)obj).Compile(h,info);\r
                                }\r
+\r
+\r
                        }\r
                        else\r
                        {\r
@@ -293,10 +311,14 @@ namespace System.Xml.Schema
                                if(isAbstract)\r
                                        error(h,"abstract must be absent");\r
 \r
+                               //FIXME: Should we reset the values\r
+                               if(MinOccurs > MaxOccurs)\r
+                                       error(h,"minOccurs must be less than or equal to maxOccurs");\r
+\r
                                if(refName == null || RefName.IsEmpty)\r
                                {\r
-                                       if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && info.formDefault == XmlSchemaForm.Qualified))\r
-                                               this.targetNamespace = info.targetNS;\r
+                                       if(form == XmlSchemaForm.Qualified || (form == XmlSchemaForm.None && info.ElementFormDefault == XmlSchemaForm.Qualified))\r
+                                               this.targetNamespace = info.TargetNamespace;\r
                                        else\r
                                                this.targetNamespace = string.Empty;\r
 \r
@@ -307,51 +329,65 @@ namespace System.Xml.Schema
                                        else\r
                                                this.qName = new XmlQualifiedName(this.name, this.targetNamespace);\r
                                \r
+                                       XmlSchemaDerivationMethod allblock = XmlSchemaDerivationMethod.Extension | \r
+                                               XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution;\r
+\r
                                        if(block == XmlSchemaDerivationMethod.All)\r
-                                               blockResolved = XmlSchemaDerivationMethod.All;\r
+                                               blockResolved = allblock;\r
                                        else if(block == XmlSchemaDerivationMethod.None)\r
-                                               blockResolved = info.blockDefault & (XmlSchemaDerivationMethod.Extension | \r
-                                                       XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution);\r
-                                       else \r
-                                               blockResolved = block & (XmlSchemaDerivationMethod.Extension | \r
-                                                       XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.Substitution);\r
+                                               blockResolved = info.BlockDefault & allblock;\r
+                                       else\r
+                                       {\r
+                                               if((block & ~allblock) != 0)\r
+                                                       warn(h,"Some of the values for block are invalid in this context");\r
+                                               blockResolved = block & allblock;\r
+                                       }\r
 \r
                                        if(schemaType != null && schemaTypeName != null && !schemaTypeName.IsEmpty)\r
                                        {\r
                                                error(h,"both schemaType and content can't be present");\r
                                        }\r
-                                       else\r
+\r
+                                       //Even if both are present, read both of them.\r
+                                       if(schemaType != null)\r
                                        {\r
-                                               if(schemaType != null)\r
+                                               if(schemaType is XmlSchemaSimpleType)\r
                                                {\r
-                                                       if(schemaType is XmlSchemaSimpleType)\r
-                                                               errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);\r
-                                                       else if(schemaType is XmlSchemaComplexType)\r
-                                                               errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);\r
-                                                       else\r
-                                                               error(h,"only simpletype or complextype is allowed");\r
+                                                       errorCount += ((XmlSchemaSimpleType)schemaType).Compile(h,info);\r
                                                }\r
-                                               else\r
+                                               else if(schemaType is XmlSchemaComplexType)\r
                                                {\r
-                                                       if(schemaTypeName == null || schemaTypeName.IsEmpty)\r
-                                                       {\r
-                                                               error(h,"one of schemaType or schemaTypeName must be present: line 336 "+ hash);\r
-                                                       }\r
+                                                       errorCount += ((XmlSchemaComplexType)schemaType).Compile(h,info);\r
                                                }\r
+                                               else\r
+                                                       error(h,"only simpletype or complextype is allowed");\r
+                                       }\r
+                                       if(schemaTypeName != null && !schemaTypeName.IsEmpty)\r
+                                       {\r
+                                               if(!XmlSchemaUtil.CheckQName(SchemaTypeName))\r
+                                                       error(h,"SchemaTypeName must be an XmlQualifiedName");\r
+                                       }\r
+                                       if(SubstitutionGroup != null && !SubstitutionGroup.IsEmpty)\r
+                                       {\r
+                                               if(!XmlSchemaUtil.CheckQName(SubstitutionGroup))\r
+                                                       error(h,"SubstitutionGroup must be a valid XmlQualifiedName");\r
                                        }\r
 \r
                                        foreach(XmlSchemaObject obj in constraints)\r
                                        {\r
                                                if(obj is XmlSchemaUnique)\r
-                                                       ((XmlSchemaUnique)obj).Compile(h,info);\r
+                                                       errorCount += ((XmlSchemaUnique)obj).Compile(h,info);\r
                                                else if(obj is XmlSchemaKey)\r
-                                                       ((XmlSchemaKey)obj).Compile(h,info);\r
+                                                       errorCount += ((XmlSchemaKey)obj).Compile(h,info);\r
                                                else if(obj is XmlSchemaKeyref)\r
-                                                       ((XmlSchemaKeyref)obj).Compile(h,info);\r
+                                                       errorCount += ((XmlSchemaKeyref)obj).Compile(h,info);\r
                                        }\r
                                }\r
                                else\r
                                {\r
+                                       if(!XmlSchemaUtil.CheckQName(RefName))\r
+                                               error(h,"RefName must be a XmlQualifiedName");\r
+\r
                                        if(name != null)\r
                                                error(h,"name must not be present when ref is present");\r
                                        if(Constraints.Count != 0)\r
@@ -372,8 +408,9 @@ namespace System.Xml.Schema
                                                error(h,"simpleType or complexType must be absent");\r
                                }\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        return errorCount;\r
                }\r
                \r
@@ -513,6 +550,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               element.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               element.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 92ec68ec3f6e9343b1f24d513599c253a70a034a..71f46130458a10027312dc9ebfba29df6139aceb 100755 (executable)
@@ -53,6 +53,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               enumeration.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               enumeration.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 55650775efc1a23fb55e21739c34f87328b40b7d..500cc2d01f7812b557a5aa72bc34b1bc04c2e023 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               fraction.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               fraction.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index ff047eda69435478b6b34859e0bc64cdce052a69..46f89fc9ed5c4621b410c8bf303e5fdc74e447b3 100755 (executable)
@@ -44,6 +44,7 @@ namespace System.Xml.Schema
                }\r
 \r
                // 1. name must be present\r
+               // 2. MinOccurs & MaxOccurs of the Particle must be absent\r
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
@@ -52,31 +53,38 @@ namespace System.Xml.Schema
                        else if(!XmlSchemaUtil.CheckNCName(this.name)) \r
                                error(h,"attribute name must be NCName");\r
                        else\r
-                               qualifiedName = new XmlQualifiedName(Name,info.targetNS);\r
-                       \r
+                               qualifiedName = new XmlQualifiedName(Name,info.TargetNamespace);\r
+\r
                        if(Particle == null)\r
                        {\r
                                error(h,"Particle is required");\r
                        }\r
-                       else if(Particle is XmlSchemaChoice)\r
-                       {\r
-                               errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);\r
-                       }\r
-                       else if(Particle is XmlSchemaSequence)\r
-                       {\r
-                               errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);\r
-                       }\r
-                       else if(Particle is XmlSchemaAll)\r
+                       else \r
                        {\r
-                               errorCount += ((XmlSchemaAll)Particle).Compile(h,info);\r
-                       }\r
-                       else\r
-                       {\r
-                               error(h,"only all,choice or sequence are allowed");\r
+                               if(Particle.MaxOccursString != null)\r
+                                       Particle.error(h,"MaxOccurs must not be present when the Particle is a child of Group");\r
+                               if(Particle.MinOccursString != null)\r
+                                       Particle.error(h,"MinOccurs must not be present when the Particle is a child of Group");\r
+                       \r
+                               if(Particle is XmlSchemaChoice)\r
+                               {\r
+                                       errorCount += ((XmlSchemaChoice)Particle).Compile(h,info);\r
+                               }\r
+                               else if(Particle is XmlSchemaSequence)\r
+                               {\r
+                                       errorCount += ((XmlSchemaSequence)Particle).Compile(h,info);\r
+                               }\r
+                               else if(Particle is XmlSchemaAll)\r
+                               {\r
+                                       errorCount += ((XmlSchemaAll)Particle).Compile(h,info);\r
+                               }\r
+                               else\r
+                               {\r
+                                       error(h,"only all,choice or sequence are allowed");\r
+                               }\r
                        }\r
-\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -126,6 +134,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               group.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               group.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 04e50b5274cc5ea076c12c0ae6cf95a404ff707d..83924d43fe637b6add197f921dc2f9ab404049f9 100755 (executable)
@@ -36,13 +36,19 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
+                       //FIXME: Should we reset the values\r
+                       if(MinOccurs > MaxOccurs)\r
+                               error(h,"minOccurs must be less than or equal to maxOccurs");\r
+\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
+\r
                        if(refName == null || refName.IsEmpty)\r
                        {\r
                                error(h,"ref must be present");\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
-                       \r
+                       else if(!XmlSchemaUtil.CheckQName(RefName))\r
+                               error(h, "RefName must be a valid XmlQualifiedName");\r
+\r
                        return errorCount;\r
                }\r
                \r
@@ -116,6 +122,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               groupref.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               groupref.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index e683909a1869952279328741d27404cf0fc3cf00..8c3bd87994e1e15f879352f2090d95d2d62f9bcb 100755 (executable)
@@ -59,17 +59,32 @@ namespace System.Xml.Schema
                        else if(!XmlSchemaUtil.CheckNCName(this.name)) \r
                                error(h,"attribute name must be NCName");\r
                        else\r
-                               this.qName = new XmlQualifiedName(Name,info.targetNS);\r
+                               this.qName = new XmlQualifiedName(Name,info.TargetNamespace);\r
 \r
                        //TODO: Compile Xpath. \r
                        if(Selector == null)\r
                                error(h,"selector must be present");\r
-               \r
+                       else\r
+                       {\r
+                               errorCount += Selector.Compile(h,info);\r
+                       }\r
+\r
                        if(Fields.Count == 0)\r
                                error(h,"atleast one field value must be present");\r
-\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       else\r
+                       {\r
+                               foreach(XmlSchemaObject obj in Fields)\r
+                               {\r
+                                       if(obj is XmlSchemaXPath)\r
+                                       {\r
+                                               XmlSchemaXPath field = (XmlSchemaXPath)obj;\r
+                                               errorCount += field.Compile(h,info);\r
+                                       }\r
+                                       else\r
+                                               error(h,"Object of type "+obj.GetType()+" is invalid in the Fields Collection");\r
+                               }\r
+                       }\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
index d8636aefc656e1d7e1890fdae339d046e64b99ee..e993a2e69e10c4834ea948e153a9f5ab51c7ed73 100755 (executable)
@@ -75,6 +75,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               import.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               import.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 413e37a49252283343fdba8b7e8d73af0685bd6b..c592557da0a27f8a02c69977ecc3f5074e279a40 100755 (executable)
@@ -61,6 +61,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               include.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               include.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index d52bf1d9f8d97ce0cd34749439b1a3fd37e70524..5e9960635f7d942f7574dd38ac32eaed89fca77b 100755 (executable)
@@ -1,20 +1,24 @@
 using System;\r
 using System.Xml;\r
+using System.Collections;\r
 \r
 namespace System.Xml.Schema\r
 {\r
        /// <summary>\r
        /// This class would store the infomation we need during compilation.\r
-       /// (maybe during validation too.. who knows)\r
        /// </summary>\r
        internal class XmlSchemaInfo\r
        {\r
                internal XmlSchemaInfo()\r
-               {}\r
+               {\r
+                       IDCollection = new Hashtable();\r
+               }\r
 \r
-               internal string targetNS;\r
-               internal XmlSchemaDerivationMethod finalDefault;\r
-               internal XmlSchemaDerivationMethod blockDefault;\r
-               internal XmlSchemaForm formDefault;\r
+               internal string TargetNamespace = null;\r
+               internal XmlSchemaDerivationMethod FinalDefault = XmlSchemaDerivationMethod.None;\r
+               internal XmlSchemaDerivationMethod BlockDefault = XmlSchemaDerivationMethod.None;\r
+               internal XmlSchemaForm ElementFormDefault = XmlSchemaForm.None;\r
+               internal XmlSchemaForm AttributeFormDefault = XmlSchemaForm.None;\r
+               internal Hashtable IDCollection;\r
        }\r
-}\r
+}
\ No newline at end of file
index e6463c2d4a658de1fba908fde16583342e47ef6f..70482c5ed3aa481de57bc8c09cbcd0385ff54057 100755 (executable)
@@ -75,6 +75,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               key.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               key.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
@@ -112,6 +116,8 @@ namespace System.Xml.Schema
                                if(level <= 3 && reader.LocalName == "field")\r
                                {\r
                                        level = 3;\r
+                                       if(key.Selector == null)\r
+                                               error(h,"selector must be defined before field declarations",null);\r
                                        XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");\r
                                        if(field != null)\r
                                                key.Fields.Add(field);\r
index 25208e6c754609a2d70d497b78dc9b7ef801f2e5..9cd08c650050b1175f4ec2786aa437a5604e1da7 100755 (executable)
@@ -33,9 +33,12 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal new int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
-                       errorCount = base.Compile(h,info);\r
+                       errorCount += base.Compile(h,info);\r
                        if(refer == null || refer.IsEmpty)\r
                                error(h,"refer must be present");\r
+                       else if(!XmlSchemaUtil.CheckQName(refer))\r
+                               error(h,"Refer is not a valid XmlQualifiedName");\r
+\r
                        return errorCount;\r
                }\r
                \r
@@ -96,6 +99,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               keyref.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               keyref.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
@@ -133,6 +140,8 @@ namespace System.Xml.Schema
                                if(level <= 3 && reader.LocalName == "field")\r
                                {\r
                                        level = 3;\r
+                                       if(keyref.Selector == null)\r
+                                               error(h,"selector must be defined before field declarations",null);\r
                                        XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");\r
                                        if(field != null)\r
                                                keyref.Fields.Add(field);\r
index a1e2733213a31e198d6798692819217a43fdf506..ad0359fed633af55a5813d3a88a36efdcb71ae7c 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               length.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               length.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index d5755ef1e18397e0204dc17776ef8b7db2b6c8e4..cdc4358a282b4df930eccc8b7880e49ebf7a6980 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               maxex.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               maxex.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 03e503c7896deb41427bb256153542f606099002..a4533ef19d26436556e14c9a074de9b43cf560e8 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               maxi.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               maxi.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 1cb744bbcfb1a9055f22e0bb9cf44f1c31ea153f..0e0169618fdd017bb7ee8ae7d71beb3a8addc0ad 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               length.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               length.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 12e3224b7500004b1c62ec171869184d18cfaae7..84f2acb884dfc617cd6dafa8149cc0420b7641fb 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               minex.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               minex.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 0116a6505c314cede0c0154e0ddf909cf6a0bd99..0640a04dc1399e19d3fe9d81eff48c7e9fc5a994 100755 (executable)
@@ -61,6 +61,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               mini.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               mini.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index efee3a1c8c5b6b7fd8f7bbc1ec68e318a2601a19..04b876e81de0d6e343643fedc8789cabaee8afd5 100755 (executable)
@@ -62,6 +62,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               length.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               length.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index cd89570ff2c9cd88bb8c66cc1deeec621ce72ca6..32667258cd0466988af4a3eea9d7acf40abbfe5b 100755 (executable)
@@ -55,18 +55,17 @@ namespace System.Xml.Schema
                        else if(!XmlSchemaUtil.CheckNCName(this.name)) \r
                                error(h,"attribute name must be NCName");\r
                        else\r
-                               qualifiedName = new XmlQualifiedName(Name,info.targetNS);\r
+                               qualifiedName = new XmlQualifiedName(Name,info.TargetNamespace);\r
 \r
-                       if(Public==null||Public == "")\r
+                       if(Public==null)\r
                                error(h,"public must be present");\r
                        else if(!XmlSchemaUtil.CheckAnyUri(Public))\r
                                error(h,"public must be anyURI");\r
 \r
-                       if(system != null && XmlSchemaUtil.CheckAnyUri(system))\r
-                               error(h,"system must be anyURI");\r
-\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       if(system != null && !XmlSchemaUtil.CheckAnyUri(system))\r
+                               error(h,"system must be present and of Type anyURI");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -125,6 +124,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               notation.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               notation.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 2f7cd6e0d196e94ab2c567b05636d83e507ac491..07f14c657d057b3ede52b24e2aff7e96ea41a9c3 100755 (executable)
@@ -67,6 +67,5 @@ namespace System.Xml.Schema
                {\r
                        ValidationHandler.RaiseValidationWarning(handle,message, innerException);\r
                }\r
-\r
        }\r
 }
\ No newline at end of file
index 2a3f38b86b8b211cd6a18cab48c64aedcbf80070..ad1dfc37b7b33aa27e66a273ad5afd7d33919600 100755 (executable)
@@ -38,7 +38,7 @@ namespace System.Xml.Schema
                                        if(val >= 0 && (val == Decimal.Truncate(val)))\r
                                        {\r
                                                maxOccurs = val;\r
-                                               maxstr = value;\r
+                                               maxstr = val.ToString();\r
                                        }\r
                                        else\r
                                        {\r
@@ -59,7 +59,7 @@ namespace System.Xml.Schema
                                if(val >= 0 && (val == Decimal.Truncate(val)))\r
                                {\r
                                        minOccurs = val;\r
-                                       minstr   = value;\r
+                                       minstr   = val.ToString();\r
                                }\r
                                else\r
                                {\r
index 0bb1485e6454070099e75771391cf5f63f18f71b..3ce29d5e00248134093bb748f658905bd10932b6 100755 (executable)
@@ -53,6 +53,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               pattern.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               pattern.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 4b7394afd8f8c0ab6605a04aa38a82bcd83a8e92..bd95b543b0c917d4e8ac39b7c7cdd11c8e77b946 100755 (executable)
@@ -87,6 +87,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               redefine.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               redefine.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index ce7797fbac518e77581bd6f1c956acd5b011fe97..79c69688a0d18c75106f92c7ef3644fbb3c4db28 100755 (executable)
@@ -31,6 +31,12 @@ namespace System.Xml.Schema
                [MonoTODO]\r
                internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
                {\r
+                       //FIXME: Should we reset the values\r
+                       if(MinOccurs > MaxOccurs)\r
+                               error(h,"minOccurs must be less than or equal to maxOccurs");\r
+\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
+\r
                        foreach(XmlSchemaObject obj in Items)\r
                        {\r
                                if(obj is XmlSchemaElement)\r
@@ -119,6 +125,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               sequence.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               sequence.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 49945c879d112e3baac0d08353fda34ab62d19d8..a1c3daf13380ea70b3c74e1caef082d742cd8392 100755 (executable)
@@ -50,8 +50,8 @@ namespace System.Xml.Schema
                                else\r
                                        error(h,"simpleContent can't have any value other than restriction or extention");\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
                        return errorCount;\r
                }\r
                \r
@@ -93,6 +93,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               simple.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               simple.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 6590ca9616687057e2840c34d0f8922a3c6680c3..98c9b22eb3ed8fba0f6ccb4ef5f95c254927ffc0 100755 (executable)
@@ -53,10 +53,12 @@ namespace System.Xml.Schema
                        {\r
                                error(h, "base must be present and a QName");\r
                        }\r
-                       \r
+                       else if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
+                               error(h,"BaseTypeName must be a QName");\r
+\r
                        if(this.AnyAttribute != null)\r
                        {\r
-                               AnyAttribute.Compile(h,info);\r
+                               errorCount += AnyAttribute.Compile(h,info);\r
                        }\r
 \r
                        foreach(XmlSchemaObject obj in Attributes)\r
@@ -64,18 +66,18 @@ namespace System.Xml.Schema
                                if(obj is XmlSchemaAttribute)\r
                                {\r
                                        XmlSchemaAttribute attr = (XmlSchemaAttribute) obj;\r
-                                       attr.Compile(h,info);\r
+                                       errorCount += attr.Compile(h,info);\r
                                }\r
-                               else if(obj is XmlSchemaAttributeGroup)\r
+                               else if(obj is XmlSchemaAttributeGroupRef)\r
                                {\r
-                                       XmlSchemaAttributeGroup atgrp = (XmlSchemaAttributeGroup) obj;\r
-                                       atgrp.Compile(h,info);\r
+                                       XmlSchemaAttributeGroupRef atgrp = (XmlSchemaAttributeGroupRef) obj;\r
+                                       errorCount += atgrp.Compile(h,info);\r
                                }\r
                                else\r
                                        error(h,obj.GetType() +" is not valid in this place::SimpleConentExtension");\r
                        }\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -126,6 +128,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               extension.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               extension.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 83138caad84d24e118abad464f2b637b5a1ad144..3a7be89588a4ff9f8cf12036fd42b67664ce6c66 100755 (executable)
@@ -81,6 +81,8 @@ namespace System.Xml.Schema
                        {\r
                                error(h, "base must be present and a QName");\r
                        }\r
+                       else if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
+                               error(h,"BaseTypeName must be a QName");\r
 \r
                        if(BaseType != null)\r
                        {\r
@@ -110,8 +112,8 @@ namespace System.Xml.Schema
                        \r
                        //TODO: Compile Facets: Looks like they are a part of datatypes. So we'll do them with the datatypes\r
 \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(Id))\r
-                               error(h, "id must be a valid ID");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
                        return errorCount;\r
                }\r
                \r
@@ -162,6 +164,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               restriction.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               restriction.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 76365b0549e8794a1e267434c0e6c969e8e9d114..2d83686176cad8ea6d3c705ab185dbe5b9027435 100755 (executable)
@@ -67,24 +67,13 @@ namespace System.Xml.Schema
                                else if(!XmlSchemaUtil.CheckNCName(this.Name)) // b.1.2\r
                                        error(h,"name attribute of a simpleType must be NCName");\r
                                else\r
-                                       this.qName = new XmlQualifiedName(this.Name,info.targetNS);\r
+                                       this.qName = new XmlQualifiedName(this.Name,info.TargetNamespace);\r
                                \r
                                //NOTE: Although the FinalResolved can be Empty, it is not a valid value for Final\r
                                //DEVIATION: If an error occurs, the finaldefault is always consulted. This deviates\r
                                //                       from the way MS implementation works.\r
                                switch(this.Final) //b.3, b.4\r
                                {\r
-                                               // Invalid values: Throw error and use "prohibited substitutions"\r
-                                       case XmlSchemaDerivationMethod.Substitution:\r
-                                               error(h,"substition is not a valid value for final in a simpletype");\r
-                                               goto case XmlSchemaDerivationMethod.None;\r
-                                       case XmlSchemaDerivationMethod.Extension:\r
-                                               error(h,"extension is not a valid value for final in a simpletype");\r
-                                               goto case XmlSchemaDerivationMethod.None;\r
-                                       case XmlSchemaDerivationMethod.Empty:\r
-                                               error(h,"empty is not a valid value for final in simpletype");\r
-                                               goto case XmlSchemaDerivationMethod.None;\r
-                                               //valid cases:\r
                                        case XmlSchemaDerivationMethod.All:\r
                                                this.finalResolved = XmlSchemaDerivationMethod.All;\r
                                                break;\r
@@ -97,24 +86,21 @@ namespace System.Xml.Schema
                                        case XmlSchemaDerivationMethod.Restriction:\r
                                                this.finalResolved = XmlSchemaDerivationMethod.Restriction;\r
                                                break;\r
-                                               // If mutliple values are specified\r
                                        default:\r
-                                               error(h,"simpletype can't have more than one value for final");\r
+                                               error(h,"The value of final attribute is not valid for simpleType");\r
                                                goto case XmlSchemaDerivationMethod.None;\r
                                                // use assignment from finaldefault on schema.\r
-                                               // The possible values of finalDefault on schema are #all | List of (extension | restriction)\r
-                                               // Of these, the only possible values for us are #all | restriction.\r
                                        case XmlSchemaDerivationMethod.None: // b.5\r
-                                               if(info.finalDefault == XmlSchemaDerivationMethod.All)\r
+                                               if(info.FinalDefault == XmlSchemaDerivationMethod.All)\r
                                                        finalResolved = XmlSchemaDerivationMethod.All;\r
-                                               else // Either Restriction or Empty\r
-                                                       finalResolved = info.finalDefault & XmlSchemaDerivationMethod.Restriction;\r
+                                               else \r
+                                                       finalResolved = info.FinalDefault & (XmlSchemaDerivationMethod.Restriction | XmlSchemaDerivationMethod.List |\r
+                                                               XmlSchemaDerivationMethod.Extension | XmlSchemaDerivationMethod.Union );\r
                                                break;\r
                                }\r
                        }\r
 \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(this.Id))\r
-                               error(h,"id must be a valid ID");\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        if(this.Content == null) //a.3,b.2\r
                                error(h,"Content is required in a simpletype");\r
@@ -185,6 +171,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               stype.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               stype.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 24d465917e908b88b84b85cd051e9b6b20004a74..a409ed2c9f403c9eeffa4cf5eb4a8ecadc446f8a 100755 (executable)
@@ -49,17 +49,18 @@ namespace System.Xml.Schema
                {\r
                        errorCount = 0;\r
 \r
-                       if(this.itemType != null && !this.ItemTypeName.IsEmpty)\r
+                       if(ItemType != null && !ItemTypeName.IsEmpty)\r
                                error(h, "both itemType and simpletype can't be present");\r
-                       if(this.itemType == null && this.ItemTypeName.IsEmpty)\r
+                       if(ItemType == null && ItemTypeName.IsEmpty)\r
                                error(h, "one of itemType or simpletype must be present");\r
-                       if(this.itemType != null)\r
+                       if(ItemType != null)\r
                        {\r
-                               errorCount += this.itemType.Compile(h,info);\r
+                               errorCount += ItemType.Compile(h,info);\r
                        }\r
-\r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(this.Id))\r
-                               error(h,"id must be a valid ID");\r
+                       if(!XmlSchemaUtil.CheckQName(ItemTypeName))\r
+                               error(h,"BaseTypeName must be a XmlQualifiedName");\r
+                       \r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -110,6 +111,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               list.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               list.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 82e81d8f5b1b9630e1abde81fbb6f4383f6b151e..8a071785bb2420e6d0b40cfed2f80ef317c2c615 100755 (executable)
@@ -72,9 +72,10 @@ namespace System.Xml.Schema
                        {\r
                                errorCount += this.baseType.Compile(h,info);\r
                        }\r
+                       if(!XmlSchemaUtil.CheckQName(BaseTypeName))\r
+                               error(h,"BaseTypeName must be a XmlQualifiedName");\r
 \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(this.Id))\r
-                               error(h,"id must be a valid ID");\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -125,6 +126,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               restriction.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               restriction.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 844c22070c7209d03cb450bd3110edd1a76ae58a..9d316458e38e5a2f3c5e4681323a8a86d7067f8c 100755 (executable)
@@ -42,11 +42,6 @@ namespace System.Xml.Schema
                        errorCount = 0;\r
 \r
                        int count = BaseTypes.Count;\r
-                       if(MemberTypes != null)\r
-                               count += MemberTypes.Length;\r
-\r
-                       if(count == 0)\r
-                               error(h, "Atleast one simpletype or membertype must be present");\r
 \r
                        foreach(XmlSchemaObject obj in baseTypes)\r
                        {\r
@@ -65,16 +60,22 @@ namespace System.Xml.Schema
                        {\r
                                for(int i=0; i< memberTypes.Length; i++)\r
                                {\r
-                                       if(memberTypes[i] == null)\r
+                                       if(memberTypes[i] == null || !XmlSchemaUtil.CheckQName(MemberTypes[i]))\r
                                        {\r
-                                               warn(h,"memberTypes should not have a null value");\r
+                                               warn(h,"Invalid membertype");\r
                                                memberTypes[i] = XmlQualifiedName.Empty;\r
                                        }\r
+                                       else\r
+                                       {\r
+                                               count += MemberTypes.Length;\r
+                                       }\r
                                }\r
                        }\r
 \r
-                       if(this.Id != null && !XmlSchemaUtil.CheckID(this.Id))\r
-                               error(h,"id must be a valid ID");\r
+                       if(count == 0)\r
+                               error(h, "Atleast one simpletype or membertype must be present");\r
+\r
+                       XmlSchemaUtil.CompileID(Id,this,info.IDCollection,h);\r
 \r
                        return errorCount;\r
                }\r
@@ -131,6 +132,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               union.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               union.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index bb9aaf599ae8417b2b7d0c8bd8d9381a8e24b422..152d7d500d6a73c26ff2a26100738e9776363234 100755 (executable)
@@ -61,6 +61,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               td.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               td.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 95516078ec16119c584e67d953036d71420f008f..754a3eaa0276ab71cbf6faa3591c8632329ab7f4 100755 (executable)
@@ -74,6 +74,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               unique.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               unique.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
@@ -111,6 +115,8 @@ namespace System.Xml.Schema
                                if(level <= 3 && reader.LocalName == "field")\r
                                {\r
                                        level = 3;\r
+                                       if(unique.Selector == null)\r
+                                               error(h,"selector must be defined before field declarations",null);\r
                                        XmlSchemaXPath field = XmlSchemaXPath.Read(reader,h,"field");\r
                                        if(field != null)\r
                                                unique.Fields.Add(field);\r
index d3a07b09edd89871230b6c75daeb981bdf13cb83..698c647ccc23a5d73cf17eeb36aa58e32a72c25c 100755 (executable)
@@ -1,5 +1,6 @@
 using System;\r
 using System.Xml;\r
+using System.Collections;\r
 \r
 namespace System.Xml.Schema\r
 {\r
@@ -12,17 +13,19 @@ namespace System.Xml.Schema
                private XmlSchemaUtil()\r
                {}\r
 \r
-               [MonoTODO]\r
-               public static bool CheckID(string id)\r
+               public static void CompileID(string id,  XmlSchemaObject xso, Hashtable idCollection, ValidationEventHandler h)\r
                {\r
                        //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#ID\r
                        // 1. ID must be a NCName\r
                        // 2. ID must be unique in the schema\r
+                       if(id == null)\r
+                               return;\r
                        if(!CheckNCName(id)) \r
-                               return false;\r
-                       //If !unique\r
-\r
-                       return true;\r
+                               xso.error(h,id+" is not a valid id attribute");\r
+                       else if(idCollection.ContainsKey(id))\r
+                               xso.error(h,"Duplicate id attribute "+id);\r
+                       else\r
+                               idCollection.Add(id,xso);\r
                }\r
 \r
                [MonoTODO]\r
@@ -36,6 +39,12 @@ namespace System.Xml.Schema
                        //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#token\r
                        return true;\r
                }\r
+\r
+               public static bool CheckNormalizedString(string token)\r
+               {\r
+                       return true;\r
+               }\r
+\r
                public static bool CheckLanguage(string lang)\r
                {\r
                        //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#language\r
@@ -55,6 +64,10 @@ namespace System.Xml.Schema
                        }\r
                }\r
 \r
+               public static bool CheckQName(XmlQualifiedName qname)\r
+               {\r
+                       return true;\r
+               }\r
                public static bool IsValidQName(string qname)\r
                {\r
                        foreach(string part in qname.Split(new char[]{':'},2))\r
@@ -133,6 +146,10 @@ namespace System.Xml.Schema
                                return decimal.Zero;\r
                        }\r
                }\r
+\r
+               // Is some value is read, return it.\r
+               // If no values return empty.\r
+               // If exception, return none\r
                public static XmlSchemaDerivationMethod ReadDerivationAttribute(XmlReader reader, out Exception innerExcpetion, string name)\r
                {\r
                        innerExcpetion = null;\r
@@ -140,7 +157,7 @@ namespace System.Xml.Schema
                        {\r
                                string list = reader.Value;\r
                                string warn = "";\r
-                               XmlSchemaDerivationMethod val = XmlSchemaDerivationMethod.None;\r
+                               XmlSchemaDerivationMethod val = 0;\r
                                \r
                                if(list.IndexOf("#all") != -1 && list.Trim() != "#all")\r
                                {\r
@@ -176,7 +193,7 @@ namespace System.Xml.Schema
                        catch(Exception ex)\r
                        {\r
                                innerExcpetion = ex;\r
-                               return 0;\r
+                               return XmlSchemaDerivationMethod.None;\r
                        }\r
                }\r
 \r
index 1cc5d375fbfc07ea89aad430b71a25f5c26b5b41..773a9b0a32329be45d3a226aa21c071a61b99593 100755 (executable)
@@ -61,6 +61,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               ws.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               ws.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r
index 6317270f217459047b7bbe0bc44077dfb1270dd9..e20d71a57a86b18d85cdcdb96a42dae355df1f5d 100755 (executable)
@@ -24,6 +24,13 @@ namespace System.Xml.Schema
                        get{ return  xpath; } \r
                        set{ xpath = value; }\r
                }\r
+\r
+               internal int Compile(ValidationEventHandler h, XmlSchemaInfo info)\r
+               {\r
+                       XmlSchemaUtil.CompileID(Id, this, info.IDCollection, h);\r
+                       return errorCount;\r
+               }\r
+\r
                //<selector \r
                //  id = ID \r
                //  xpath = a subset of XPath expression, see below \r
@@ -62,6 +69,10 @@ namespace System.Xml.Schema
                                }\r
                                else\r
                                {\r
+                                       if(reader.Prefix == "xmlns")\r
+                                               path.Namespaces.Add(reader.LocalName, reader.Value);\r
+                                       else if(reader.Name == "xmlns")\r
+                                               path.Namespaces.Add("",reader.Value);\r
                                        //TODO: Add to Unhandled attributes\r
                                }\r
                        }\r