2003-10-26 Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
authorAtsushi Eno <atsushieno@gmail.com>
Sun, 26 Oct 2003 03:41:55 +0000 (03:41 -0000)
committerAtsushi Eno <atsushieno@gmail.com>
Sun, 26 Oct 2003 03:41:55 +0000 (03:41 -0000)
* XsdValidatingReader.cs : xsi:type should be normalized. More cleanup.
* XsdParticleValidationState.cs : Reverted default content processing
  to lax. It is msxsdtest/wildCard/wildG038.xsd which looks incorrect.

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

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

index 0c76f6372133b25f4e7bb546432f19045131982a..9a336163720bc7f97d82a5af73a5a692da081194 100644 (file)
@@ -1,3 +1,9 @@
+2003-10-26  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
+
+       * XsdValidatingReader.cs : xsi:type should be normalized. More cleanup.
+       * XsdParticleValidationState.cs : Reverted default content processing
+         to lax. It is msxsdtest/wildCard/wildG038.xsd which looks incorrect.
+
 2003-10-25  Atsushi Enomoto <ginga@kit.hi-ho.ne.jp>
 
        * XsdValidatingReader.cs : Removed MonoTODO which was implemented in
index 58b42c5107a73fa796fc7821328f19bca714d166..934905bfda2ee2cba8a5e18236a69159eb6ca835 100644 (file)
@@ -31,7 +31,7 @@ namespace Mono.Xml.Schema
                public XsdValidationStateManager ()
                {
                        table = new Hashtable ();
-                       processContents = XmlSchemaContentProcessing.Lax;
+                       processContents = XmlSchemaContentProcessing.Strict; // not Lax
                }
 
                public XmlSchemaElement CurrentElement {
index 561f350b304404f709bf0ae39bd4bdc334bf8e2c..45341cb2ca6bbfc5d2910af4b3670df2b5cde651 100644 (file)
@@ -537,8 +537,7 @@ namespace Mono.Xml.Schema
                                if (dt != null) {
                                        try {
                                                identity = dt.ParseValue (value, NameTable, ParserContext.NamespaceManager);
-                                       } catch (Exception ex) { // FIXME: This is bad manner ;-(
-                                               // FIXME: Such exception handling is not a good idea.
+                                       } catch (Exception ex) { // FIXME: (wishlist) This is bad manner ;-(
                                                HandleError ("Identity value is invalid against its data type " + dt.TokenizedType, ex);
                                        }
                                }
@@ -576,7 +575,7 @@ namespace Mono.Xml.Schema
                                                if (itemDatatype != null) {
                                                        try {
                                                                itemDatatype.ParseValue (each, NameTable, ParserContext.NamespaceManager);
-                                                       } catch (Exception ex) { // FIXME: better exception handling ;-(
+                                                       } catch (Exception ex) { // FIXME: (wishlist) better exception handling ;-(
                                                                HandleError ("List type value contains one or more invalid values.", ex);
                                                                break;
                                                        }
@@ -587,12 +586,8 @@ namespace Mono.Xml.Schema
                                        break;
                                case XmlSchemaDerivationMethod.Union:
                                        XmlSchemaSimpleTypeUnion union = st.Content as XmlSchemaSimpleTypeUnion;
-//                                     values = normalized.Split (wsChars);
-                               {
-string each = normalized;
-//                                     foreach (string each in values) {
-//                                             if (each == String.Empty)
-//                                                     continue;
+                                       {
+                                               string each = normalized;
                                                // validate against ValidatedItemType
                                                bool passed = false;
                                                foreach (object eachType in union.ValidatedTypes) {
@@ -601,7 +596,7 @@ string each = normalized;
                                                        if (itemDatatype != null) {
                                                                try {
                                                                        itemDatatype.ParseValue (each, NameTable, ParserContext.NamespaceManager);
-                                                               } catch (Exception) { // FIXME: better exception handling ;-(
+                                                               } catch (Exception) { // FIXME: (wishlist) better exception handling ;-(
                                                                        continue;
                                                                }
                                                        }
@@ -621,7 +616,6 @@ string each = normalized;
                                                }
                                        }
                                        break;
-                               // TODO: rest
                                case XmlSchemaDerivationMethod.Restriction:
                                        XmlSchemaSimpleTypeRestriction str = st.Content as XmlSchemaSimpleTypeRestriction;
                                        // facet validation
@@ -638,7 +632,7 @@ string each = normalized;
                        if (validatedDatatype != null) {
                                try {
                                        validatedDatatype.ParseValue (value, NameTable, ParserContext.NamespaceManager);
-                               } catch (Exception ex) {        // FIXME: It is really bad design ;-P
+                               } catch (Exception ex) {        // FIXME: (wishlist) It is bad manner ;-(
                                        HandleError ("Invalidly typed data was specified.", ex);
                                }
                        }
@@ -735,9 +729,9 @@ string each = normalized;
                        // Note that Schema Validity Assessment(Element) 1.2 takes
                        // precedence than 1.1 of that.
 
-                       // FIXME: xsi:type value should be normalized.
                        string xsiTypeName = reader.GetAttribute ("type", XmlSchema.InstanceNamespace);
                        if (xsiTypeName != null) {
+                               xsiTypeName = xsiTypeName.Trim (XmlChar.WhitespaceChars);
                                object xsiType = GetLocalTypeDefinition (xsiTypeName);
                                if (xsiType == null)
                                        HandleError ("The instance type was not found: " + xsiTypeName + " .");
@@ -1009,8 +1003,7 @@ string each = normalized;
                                object parsedValue = null;
                                try {
                                        dt.ParseValue (normalized, reader.NameTable, this.ParserContext.NamespaceManager);
-                               } catch (Exception ex) {
-                                       // FIXME: Such exception handling is not a good idea.
+                               } catch (Exception ex) { // FIXME: (wishlist) It is bad manner ;-(
                                        HandleError ("Attribute value is invalid against its data type " + dt.TokenizedType, ex);
                                }
                                if (attr.ValidatedFixedValue != null && attr.ValidatedFixedValue != normalized)
@@ -1147,22 +1140,21 @@ string each = normalized;
                                if (seq.SelectorMatches (this.elementQNameStack, reader) != null) {
                                        // creates and registers new entry.
                                        XsdKeyEntry entry = new XsdKeyEntry (seq, reader);
-                                       seq./*NotFound*/Entries.Add (entry);
+                                       seq.Entries.Add (entry);
                                }
                        }
 
                        // (c) Evaluate field paths.
                        foreach (XsdKeyTable seq in this.keyTables) {
                                // If possible, create new field entry candidates.
-                               for (int i = 0; i < seq./*NotFound*/Entries.Count; i++) {
-                                       XsdKeyEntry entry = seq./*NotFound*/Entries [i] as XsdKeyEntry;
+                               for (int i = 0; i < seq.Entries.Count; i++) {
+                                       XsdKeyEntry entry = seq.Entries [i] as XsdKeyEntry;
 //                                     if (entry.KeyFound)
 // FIXME: it should not be skipped for multiple key check!!
 //                                             continue;
                                        try {
                                                entry.FieldMatches (this.elementQNameStack, this);
-                                       } catch (Exception ex) {
-                                               // FIXME: Such exception handling is not a good idea.
+                                       } catch (Exception ex) { // FIXME: (wishlist) It is bad manner ;-(
                                                HandleError ("Identity field value is invalid against its data type.", ex);
                                        }
                                }
@@ -1473,9 +1465,7 @@ string each = normalized;
                                                Uri absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), tmp [i + 1]);
                                                XmlTextReader xtr = new XmlTextReader (absUri.ToString ());
                                                schema = XmlSchema.Read (xtr, null);
-                                       } catch (Exception ex) {
-                                               // FIXME: better exception handling...
-//                                             HandleError ("Errors were occured when resolving schemaLocation specified schema document.", ex);
+                                       } catch (Exception ex) { // FIXME: (wishlist) It is bad manner ;-(
                                                continue;
                                        }
                                        if (schema.TargetNamespace == null)
@@ -1498,9 +1488,7 @@ string each = normalized;
                                        Uri absUri = new Uri ((this.BaseURI != "" ? new Uri (BaseURI) : null), noNsSchemaLocation);
                                        XmlTextReader xtr = new XmlTextReader (absUri.ToString ());
                                        schema = XmlSchema.Read (xtr, null);
-                               } catch (Exception ex) {
-                                       // FIXME: better exception handling...
-//                                     HandleError ("Errors were occured when resolving schemaLocation specified schema document.", ex);
+                               } catch (Exception ex) { // FIXME: (wishlist) It is bad manner ;-(
                                }
                                if (schema != null && schema.TargetNamespace != null)
                                        HandleError ("Specified schema has different target namespace.");