You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by Mukul Gandhi <mu...@apache.org> on 2011/03/13 15:13:05 UTC

Re: svn commit: r1080317 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java

Hi Khaled,
     It seems that changes to code base in this commit causes an
infinite loop in method XSDHandler -> buildDefaultAttributes()  (the
loop while (!schemasToProcess.empty()) goes infinite)

when XML Schema 1.1 tests here are been run,

http://dev.w3.org/cvsweb/XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06/ibmMeta/cyclicRedefineIncludeImportOverride.testSet

Could you kindly investigate the issues related to this.

On Fri, Mar 11, 2011 at 12:27 AM,  <kn...@apache.org> wrote:
> Author: knoaman
> Date: Thu Mar 10 18:57:57 2011
> New Revision: 1080317
>
> URL: http://svn.apache.org/viewvc?rev=1080317&view=rev
> Log:
> Fix for defaultAttributes (need to handle default attribute groups before handling global components)
>
> Modified:
>    xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
>
> Modified: xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
> URL: http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1080317&r1=1080316&r2=1080317&view=diff
> ==============================================================================
> --- xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java (original)
> +++ xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java Thu Mar 10 18:57:57 2011
> @@ -674,6 +674,10 @@ public class XSDHandler {
>         // second phase:  fill global registries.
>         buildGlobalNameRegistries();
>
> +        if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
> +            buildDefaultAttributes();
> +        }
> +
>         // third phase:  call traversers
>         ArrayList annotationInfo = fValidateAnnotations ? new ArrayList() : null;
>         traverseSchemas(annotationInfo);
> @@ -1447,7 +1451,33 @@ public class XSDHandler {
>         } // while
>
>     } // end buildGlobalNameRegistries
> -
> +
> +    protected void buildDefaultAttributes() {
> +        Stack schemasToProcess = new Stack();
> +
> +        setSchemasVisible(fRoot);
> +        schemasToProcess.push(fRoot);
> +        while (!schemasToProcess.empty()) {
> +            XSDocumentInfo currSchemaDoc =
> +                (XSDocumentInfo)schemasToProcess.pop();
> +            final Element currDoc = currSchemaDoc.fSchemaElement;
> +
> +            // Check that we have a 'defaultAttributes' and that we have not already processed it
> +            if (currSchemaDoc.fDefaultAttributes != null && currSchemaDoc.fDefaultAGroup == null) {
> +                currSchemaDoc.fDefaultAGroup = (XSAttributeGroupDecl) getGlobalDecl(
> +                        currSchemaDoc, XSDHandler.ATTRIBUTEGROUP_TYPE, currSchemaDoc.fDefaultAttributes, currDoc);
> +            }
> +            // now we're done with this one!
> +            // now we're done with this one!
> +            DOMUtil.setHidden(currDoc, fHiddenNodes);
> +            // now add the schemas this guy depends on
> +            Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc);
> +            for (int i = 0; i < currSchemaDepends.size(); i++) {
> +                schemasToProcess.push(currSchemaDepends.elementAt(i));
> +            }
> +        } // while
> +    } // end buildDefaultAttributes
> +
>     // Beginning at the first schema processing was requested for
>     // (fRoot), this method
>     // examines each child (global schema information item) of each
> @@ -1481,15 +1511,6 @@ public class XSDHandler {
>             Element currRoot = currDoc;
>             boolean sawAnnotation = false;
>
> -            // if XML Schema 1.1, set default attribute group
> -            if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
> -                // Check that we have a 'defaultAttributes' and that we have not already processed it
> -                if (currSchemaDoc.fDefaultAttributes != null && currSchemaDoc.fDefaultAGroup == null) {
> -                    currSchemaDoc.fDefaultAGroup = (XSAttributeGroupDecl) getGlobalDecl(
> -                            currSchemaDoc, XSDHandler.ATTRIBUTEGROUP_TYPE, currSchemaDoc.fDefaultAttributes, currRoot);
> -                }
> -            }
> -
>             // traverse this schema's global decls
>             for (Element globalComp =
>                 DOMUtil.getFirstVisibleChildElement(currRoot, fHiddenNodes);




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org


Re: svn commit: r1080317 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Khaled,
   I verified the fix, and it works.

Many thanks.

On Mon, Mar 14, 2011 at 7:50 PM, Khaled Noaman <kn...@ca.ibm.com> wrote:

>
> Checked in a fix.
>
> Khaled
>




-- 
Regards,
Mukul Gandhi

Re: svn commit: r1080317 - /xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java

Posted by Khaled Noaman <kn...@ca.ibm.com>.
Checked in a fix.

Khaled





From:
Mukul Gandhi <mu...@apache.org>
To:
j-dev@xerces.apache.org
Date:
03/13/2011 10:19 AM
Subject:
Re: svn commit: r1080317 - 
/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java



Hi Khaled,
     It seems that changes to code base in this commit causes an
infinite loop in method XSDHandler -> buildDefaultAttributes()  (the
loop while (!schemasToProcess.empty()) goes infinite)

when XML Schema 1.1 tests here are been run,

http://dev.w3.org/cvsweb/XML/xml-schema-test-suite/2004-01-14/xmlschema2006-11-06/ibmMeta/cyclicRedefineIncludeImportOverride.testSet


Could you kindly investigate the issues related to this.

On Fri, Mar 11, 2011 at 12:27 AM,  <kn...@apache.org> wrote:
> Author: knoaman
> Date: Thu Mar 10 18:57:57 2011
> New Revision: 1080317
>
> URL: http://svn.apache.org/viewvc?rev=1080317&view=rev
> Log:
> Fix for defaultAttributes (need to handle default attribute groups 
before handling global components)
>
> Modified:
>   
 xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
>
> Modified: 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java
> URL: 
http://svn.apache.org/viewvc/xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java?rev=1080317&r1=1080316&r2=1080317&view=diff

> 
==============================================================================
> --- 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
(original)
> +++ 
xerces/java/branches/xml-schema-1.1-dev/src/org/apache/xerces/impl/xs/traversers/XSDHandler.java 
Thu Mar 10 18:57:57 2011
> @@ -674,6 +674,10 @@ public class XSDHandler {
>         // second phase:  fill global registries.
>         buildGlobalNameRegistries();
>
> +        if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
> +            buildDefaultAttributes();
> +        }
> +
>         // third phase:  call traversers
>         ArrayList annotationInfo = fValidateAnnotations ? new 
ArrayList() : null;
>         traverseSchemas(annotationInfo);
> @@ -1447,7 +1451,33 @@ public class XSDHandler {
>         } // while
>
>     } // end buildGlobalNameRegistries
> -
> +
> +    protected void buildDefaultAttributes() {
> +        Stack schemasToProcess = new Stack();
> +
> +        setSchemasVisible(fRoot);
> +        schemasToProcess.push(fRoot);
> +        while (!schemasToProcess.empty()) {
> +            XSDocumentInfo currSchemaDoc =
> +                (XSDocumentInfo)schemasToProcess.pop();
> +            final Element currDoc = currSchemaDoc.fSchemaElement;
> +
> +            // Check that we have a 'defaultAttributes' and that we 
have not already processed it
> +            if (currSchemaDoc.fDefaultAttributes != null && 
currSchemaDoc.fDefaultAGroup == null) {
> +                currSchemaDoc.fDefaultAGroup = (XSAttributeGroupDecl) 
getGlobalDecl(
> +                        currSchemaDoc, XSDHandler.ATTRIBUTEGROUP_TYPE, 
currSchemaDoc.fDefaultAttributes, currDoc);
> +            }
> +            // now we're done with this one!
> +            // now we're done with this one!
> +            DOMUtil.setHidden(currDoc, fHiddenNodes);
> +            // now add the schemas this guy depends on
> +            Vector currSchemaDepends = 
(Vector)fDependencyMap.get(currSchemaDoc);
> +            for (int i = 0; i < currSchemaDepends.size(); i++) {
> +                schemasToProcess.push(currSchemaDepends.elementAt(i));
> +            }
> +        } // while
> +    } // end buildDefaultAttributes
> +
>     // Beginning at the first schema processing was requested for
>     // (fRoot), this method
>     // examines each child (global schema information item) of each
> @@ -1481,15 +1511,6 @@ public class XSDHandler {
>             Element currRoot = currDoc;
>             boolean sawAnnotation = false;
>
> -            // if XML Schema 1.1, set default attribute group
> -            if (fSchemaVersion == Constants.SCHEMA_VERSION_1_1) {
> -                // Check that we have a 'defaultAttributes' and that we 
have not already processed it
> -                if (currSchemaDoc.fDefaultAttributes != null && 
currSchemaDoc.fDefaultAGroup == null) {
> -                    currSchemaDoc.fDefaultAGroup = 
(XSAttributeGroupDecl) getGlobalDecl(
> -                            currSchemaDoc, 
XSDHandler.ATTRIBUTEGROUP_TYPE, currSchemaDoc.fDefaultAttributes, 
currRoot);
> -                }
> -            }
> -
>             // traverse this schema's global decls
>             for (Element globalComp =
>                 DOMUtil.getFirstVisibleChildElement(currRoot, 
fHiddenNodes);




-- 
Regards,
Mukul Gandhi

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org