Author: atsushi
Date: 2006-12-11 00:33:38 -0500 (Mon, 11 Dec 2006)
New Revision: 69293

Modified:
   trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog
   trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
   trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
   trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
   trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
Log:
2006-12-11  Atsushi Enomoto <[EMAIL PROTECTED]>

        * XmlSchemaIdentityConstraint.cs : give conflicting component in
          the error message.
        * XmlSchemaElement.cs : When resolving "ref" and "substitutionGroup",
          It should use XmlSchema.FindElement() instead of XmlSchema.Elements
          so that it does not miss external components.
        * XmlSchemaSet.cs, XmlSchema.cs : now in one XmlSchemaSet
          compilation, make sure to not handle the same schema twice even
          at the schema level.



Modified: trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog      2006-12-11 
04:19:42 UTC (rev 69292)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/ChangeLog      2006-12-11 
05:33:38 UTC (rev 69293)
@@ -1,3 +1,14 @@
+2006-12-11  Atsushi Enomoto <[EMAIL PROTECTED]>
+
+       * XmlSchemaIdentityConstraint.cs : give conflicting component in
+         the error message.
+       * XmlSchemaElement.cs : When resolving "ref" and "substitutionGroup",
+         It should use XmlSchema.FindElement() instead of XmlSchema.Elements
+         so that it does not miss external components.
+       * XmlSchemaSet.cs, XmlSchema.cs : now in one XmlSchemaSet
+         compilation, make sure to not handle the same schema twice even
+         at the schema level.
+
 2006-10-27  Atsushi Enomoto <[EMAIL PROTECTED]>
 
        * XmlSchemaValidator.cs : it must also be fixed for method signature

Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs   2006-12-11 
04:19:42 UTC (rev 69292)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchema.cs   2006-12-11 
05:33:38 UTC (rev 69293)
@@ -287,15 +287,21 @@
                        xss.Compile ();
                }
 
-               // It is used by XmlSchemaCollection.Add(),
-               // XmlSchemaSet.Compile() and XmlSchemaSet.Remove().
+               // It is used by XmlSchemaCollection.Add() and 
XmlSchemaSet.Remove().
                internal void CompileSubset (ValidationEventHandler handler, 
XmlSchemaSet col, XmlResolver resolver)
                {
                        Hashtable handledUris = new Hashtable ();
-                       // Add this schema itself.
-                       if (SourceUri != null && SourceUri.Length > 0)
+                       CompileSubset (handler, col, resolver, handledUris);
+               }
+
+               // It is used by XmlSchemaSet.Compile().
+               internal void CompileSubset (ValidationEventHandler handler, 
XmlSchemaSet col, XmlResolver resolver, Hashtable handledUris)
+               {
+                       if (SourceUri != null && SourceUri.Length > 0) {
+                               if (handledUris.Contains (SourceUri))
+                                       return;
                                handledUris.Add (SourceUri, SourceUri);
-
+                       }
                        DoCompile (handler, handledUris, col, resolver);
                }
 

Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs    
2006-12-11 04:19:42 UTC (rev 69292)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaElement.cs    
2006-12-11 05:33:38 UTC (rev 69293)
@@ -560,7 +560,7 @@
                        if (OptimizedParticle != null)
                                return OptimizedParticle;
                        if (RefName != null && RefName != 
XmlQualifiedName.Empty) {
-                               referencedElement = schema.Elements [RefName] 
as XmlSchemaElement;
+                               referencedElement = schema.FindElement 
(RefName);
                        }
 
 //                     if (this.referencedElement != null)
@@ -613,7 +613,7 @@
                                return;
 
                        if (this.SubstitutionGroup != XmlQualifiedName.Empty) {
-                               XmlSchemaElement substElem = schema.Elements 
[SubstitutionGroup] as XmlSchemaElement;
+                               XmlSchemaElement substElem = schema.FindElement 
(SubstitutionGroup);
                                this.substitutionGroupElement = substElem;
                                if (substElem != null)
                                        substElem.substitutingElements.Add 
(this);
@@ -673,7 +673,7 @@
                        }
                        else if (RefName != XmlQualifiedName.Empty)
                        {
-                               XmlSchemaElement refElem = schema.Elements 
[RefName] as XmlSchemaElement;
+                               XmlSchemaElement refElem = schema.FindElement 
(RefName);
                                // If el is null, then it is missing sub 
components .
                                if (refElem != null) {
                                        this.referencedElement = refElem;
@@ -703,7 +703,7 @@
                        // {substitution group affiliation}
                        // 3. subsitution group's type derivation check.
                        if (this.SubstitutionGroup != XmlQualifiedName.Empty) {
-                               XmlSchemaElement substElem = schema.Elements 
[SubstitutionGroup] as XmlSchemaElement;
+                               XmlSchemaElement substElem = schema.FindElement 
(SubstitutionGroup);
                                // If el is null, then it is missing sub 
components .
                                if (substElem != null) {
                                        XmlSchemaType substSchemaType = 
substElem.ElementType as XmlSchemaType;

Modified: 
trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs 
2006-12-11 04:19:42 UTC (rev 69292)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaIdentityConstraint.cs 
2006-12-11 05:33:38 UTC (rev 69293)
@@ -101,8 +101,11 @@
                                error(h,"attribute name must be NCName");
                        else {
                                this.qName = new 
XmlQualifiedName(Name,schema.TargetNamespace);
-                               if (schema.NamedIdentities.Contains (qName))
-                                       error(h,"There is already same named 
identity constraint in this namespace.");
+                               if (schema.NamedIdentities.Contains (qName)) {
+                                       XmlSchemaIdentityConstraint existing =
+                                               schema.NamedIdentities [qName] 
as XmlSchemaIdentityConstraint;
+                                       error(h, String.Format ("There is 
already same named identity constraint in this namespace. Existing item is at 
{0}({1},{2})", existing.SourceUri, existing.LineNumber, existing.LinePosition));
+                               }
                                else
                                        schema.NamedIdentities.Add (qName, 
this);
                        }

Modified: trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs
===================================================================
--- trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs        
2006-12-11 04:19:42 UTC (rev 69292)
+++ trunk/mcs/class/System.XML/System.Xml.Schema/XmlSchemaSet.cs        
2006-12-11 05:33:38 UTC (rev 69293)
@@ -199,9 +199,10 @@
                        IDCollection.Clear ();
                        NamedIdentities.Clear ();
 
+                       Hashtable handledUris = new Hashtable ();
                        foreach (XmlSchema schema in al)
                                if (!schema.IsCompiled)
-                                       schema.CompileSubset 
(ValidationEventHandler, this, xmlResolver);
+                                       schema.CompileSubset 
(ValidationEventHandler, this, xmlResolver, handledUris);
                        foreach (XmlSchema schema in al)
                                schema.Validate (ValidationEventHandler);
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to