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 "Radu Coravu (JIRA)" <xe...@xml.apache.org> on 2012/08/13 07:40:37 UTC

[jira] [Created] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Radu Coravu created XERCESJ-1577:
------------------------------------

             Summary: Error when referencing substitution group with chameleon namespace
                 Key: XERCESJ-1577
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.0 Structures
    Affects Versions: 2.11.0
            Reporter: Radu Coravu


Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.

If I have a small schema in no-namespace like:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="elem" substitutionGroup="p.trans"/>
    <xs:element name="p.trans" abstract="true"/>
</xs:schema>


and a schema which has a target namespaces and includes it:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
    <xs:include schemaLocation="test.xsd"/>
</xs:schema>

Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:

src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.


Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


Re: [jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by Mukul Gandhi <mu...@apache.org>.
Hi Octavian,
    Thanks very much. I can now replicate the issues (XERCESJ-1577 &
XERCESJ-1578) originally mentioned in these bug reports.

I apologize for hastily doing an incorrect analysis.

On Fri, Aug 17, 2012 at 2:45 PM, Octavian Nadolu (JIRA)
<xe...@xml.apache.org> wrote:
>
>     [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436623#comment-13436623 ]
>
> Octavian Nadolu commented on XERCESJ-1577:
> ------------------------------------------
>
> [~mukul_gandhi]
> The arguments that you pass to the SourceValidator are not correct. Please make sure that after -a parameter you specify the schema file.
> So, instead of:
> jaxp.SourceValidator -a -f -xsd11 main.xsd
> you should use:
> jaxp.SourceValidator  -f -xsd11 -a main.xsd
>
> I also reproduce the problem reposted by Radu on the xml-schema-1.1-dev branch.





-- 
Regards,
Mukul Gandhi

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Radu Coravu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13442307#comment-13442307 ] 

Radu Coravu commented on XERCESJ-1577:
--------------------------------------

Even validation in XML Schema 1.0 mode has the same problem on the Xerces 1.1 branch.
As I said, the validation works on the trunk code so probably a fix was made on the trunk which was not made on the branch or the branch introduced this new problem.
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13434823#comment-13434823 ] 

Mukul Gandhi commented on XERCESJ-1577:
---------------------------------------

Here are the results I've observed on the xml-schema-1.1-dev branch,

main.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
    <xs:include schemaLocation="test.xsd"/>
</xs:schema>

test.xsd

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
    <xs:element name="elem" substitutionGroup="p.trans"/>
    <xs:element name="p.trans" abstract="true"/>
</xs:schema>

When I use the jaxp.SourceValidator sample to check the schema document main.xsd as follows,

jaxp.SourceValidator -a main.xsd          I do get the error you've mentioned

But when I invoke this sample as following (an option, -f is "full schema checking" enabled),

jaxp.SourceValidator -a -f main.xsd       (XSD 1.0 mode)

or

jaxp.SourceValidator -a -f -xsd11 main.xsd     (XSD 1.1 mode)

I don't get the error you've mentioned.

You may validate these findings, and report if you don't agree. I suspect, you're not initializing the "schema factory" or/and the Schema object with all the right options (you may look at the source code of jaxp.SourceValidator to see, that what all options are needed).  
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Comment Edited] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Octavian Nadolu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436623#comment-13436623 ] 

Octavian Nadolu edited comment on XERCESJ-1577 at 8/17/12 8:14 PM:
-------------------------------------------------------------------

@Mukul Gandhi 
The arguments that you pass to the SourceValidator are not correct. Please make sure that after -a parameter you specify the schema file.
So, instead of:
jaxp.SourceValidator -a -f -xsd11 main.xsd
you should use:
jaxp.SourceValidator  -f -xsd11 -a main.xsd

I also reproduce the problem reposted by Radu on the xml-schema-1.1-dev branch.
                
      was (Author: octavian.nadolu):
    [~mukul_gandhi]
The arguments that you pass to the SourceValidator are not correct. Please make sure that after -a parameter you specify the schema file.
So, instead of:
jaxp.SourceValidator -a -f -xsd11 main.xsd
you should use:
jaxp.SourceValidator  -f -xsd11 -a main.xsd

I also reproduce the problem reposted by Radu on the xml-schema-1.1-dev branch.
                  
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Radu Coravu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13447627#comment-13447627 ] 

Radu Coravu commented on XERCESJ-1577:
--------------------------------------

I found where the problem is:

In the method:

org.apache.xerces.impl.xs.traversers.XSAttributeCheckerXerces.checkAttributes(Element, boolean, XSDocumentInfo, boolean)

there is some code like:

if (oneAttr.valueIndex == ATTIDX_SUBSGROUP) {
.....
} else{
.....
}

If you look at the "else" branch, it contains a special fix for chameleon schemas with the comment:

 // kludge to handle chameleon includes/redefines...

That particular fix must be done also on the "if" branch.

                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433125#comment-13433125 ] 

Mukul Gandhi commented on XERCESJ-1577:
---------------------------------------

When I check your schema document which includes test.xsd, with the feature "schema full checking" enabled (equivalent to the option -f with the jaxp.SourceValidator utility), I don't get the error which you've mentioned. But when this option is set to 'false' (which is also the default value of this option), I do get the error that you've written.

>From my point of view the results you've reported is not a bug, since enabling the "schema full checking" feature loads the schema document fine.
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Radu Coravu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13435812#comment-13435812 ] 

Radu Coravu commented on XERCESJ-1577:
--------------------------------------

I checked out the sources from:

https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev

In the main() method of "jaxp.SourceValidator.main(String[])" I added some logging after this line to see if the correct factory was created:

SchemaFactory factory = SchemaFactory.newInstance(schemaLanguage);

On the first run the created factory was the one from the Java SUN implementation so I also had to add a META-INF directory from a compiled Xerces library to the "src" directory.

Is the correct factory "org.apache.xerces.jaxp.validation.XMLSchemaFactory" created in your case?
After adding the META-INF directory in the "src" the correct "org.apache.xerces.jaxp.validation.XMLSchemaFactory" factory was created by the call to " SchemaFactory.newInstance(schemaLanguage)".

then I run the /xerces-java-xml-schema-1.1-dev/samples/jaxp/SourceValidator.java main() method using the parameters:

-a file:/C:/Users/radu_coravu/Desktop/xsdProblem/main.xsd

and obtained the problem:

[Error] test.xsd:3:58: src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
[Error] test.xsd:3:58: src-resolve: Cannot resolve the name 'p.trans' to a(n) 'element declaration' component.

Using full schema checking on or off did not help.
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Comment Edited] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Radu Coravu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433913#comment-13433913 ] 

Radu Coravu edited comment on XERCESJ-1577 at 8/14/12 4:41 PM:
---------------------------------------------------------------

Hi, 

The validation works on the trunk code but it does not work on the code which exists on the branch:

https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev

The code I used is like this:

 File xsdFile = new File("C:/Users/radu_coravu/Desktop/xsdProblem/main.xsd");
        StreamSource[] schemaDocuments = new StreamSource[] {new StreamSource(xsdFile)};
        XMLSchema11Factory sf = new  XMLSchema11Factory();
        try {
            sf.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING, true);
            Schema s = sf.newSchema(schemaDocuments);
        } catch (SAXNotRecognizedException e1) {
            e1.printStackTrace();
        } catch (SAXNotSupportedException e1) {
            e1.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        }

And the received exception is this one:

org.xml.sax.SAXParseException: src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4446)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4441)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1874)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:349)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:241)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1621)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:724)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
	at org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
	at jaxp.InlineSchemaValidator.main(InlineSchemaValidator.java:367)
                
      was (Author: radu_coravu):
    Hi, 

The validation does not work on the code which exists on the branch:

https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev

The code I used is like this:

 File xsdFile = new File("C:/Users/radu_coravu/Desktop/xsdProblem/main.xsd");
        StreamSource[] schemaDocuments = new StreamSource[] {new StreamSource(xsdFile)};
        XMLSchema11Factory sf = new  XMLSchema11Factory();
        try {
            sf.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING, true);
            Schema s = sf.newSchema(schemaDocuments);
        } catch (SAXNotRecognizedException e1) {
            e1.printStackTrace();
        } catch (SAXNotSupportedException e1) {
            e1.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        }

And the received exception is this one:

org.xml.sax.SAXParseException: src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4446)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4441)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1874)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:349)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:241)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1621)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:724)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
	at org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
	at jaxp.InlineSchemaValidator.main(InlineSchemaValidator.java:367)
                  
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Radu Coravu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13433913#comment-13433913 ] 

Radu Coravu commented on XERCESJ-1577:
--------------------------------------

Hi, 

The validation does not work on the code which exists on the branch:

https://svn.apache.org/repos/asf/xerces/java/branches/xml-schema-1.1-dev

The code I used is like this:

 File xsdFile = new File("C:/Users/radu_coravu/Desktop/xsdProblem/main.xsd");
        StreamSource[] schemaDocuments = new StreamSource[] {new StreamSource(xsdFile)};
        XMLSchema11Factory sf = new  XMLSchema11Factory();
        try {
            sf.setFeature(Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING, true);
            Schema s = sf.newSchema(schemaDocuments);
        } catch (SAXNotRecognizedException e1) {
            e1.printStackTrace();
        } catch (SAXNotSupportedException e1) {
            e1.printStackTrace();
        } catch (SAXException e) {
            e.printStackTrace();
        }

And the received exception is this one:

org.xml.sax.SAXParseException: src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
	at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196)
	at org.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:132)
	at org.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:394)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4446)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:4441)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1874)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:349)
	at org.apache.xerces.impl.xs.traversers.XSDElementTraverser.traverseGlobal(XSDElementTraverser.java:241)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1621)
	at org.apache.xerces.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:724)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:644)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:611)
	at org.apache.xerces.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:577)
	at org.apache.xerces.jaxp.validation.BaseSchemaFactory.newSchema(BaseSchemaFactory.java:223)
	at jaxp.InlineSchemaValidator.main(InlineSchemaValidator.java:367)
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Commented] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Octavian Nadolu (JIRA)" <xe...@xml.apache.org>.
    [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13436623#comment-13436623 ] 

Octavian Nadolu commented on XERCESJ-1577:
------------------------------------------

[~mukul_gandhi]
The arguments that you pass to the SourceValidator are not correct. Please make sure that after -a parameter you specify the schema file.
So, instead of:
jaxp.SourceValidator -a -f -xsd11 main.xsd
you should use:
jaxp.SourceValidator  -f -xsd11 -a main.xsd

I also reproduce the problem reposted by Radu on the xml-schema-1.1-dev branch.
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

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


[jira] [Resolved] (XERCESJ-1577) Error when referencing substitution group with chameleon namespace

Posted by "Mukul Gandhi (JIRA)" <xe...@xml.apache.org>.
     [ https://issues.apache.org/jira/browse/XERCESJ-1577?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mukul Gandhi resolved XERCESJ-1577.
-----------------------------------

    Resolution: Fixed
      Assignee: Mukul Gandhi

marking this issue as fixed. the fix for this was committed with SVN revision, 1381986. the ideas suggested by Radu, were followed to make this fix.
                
> Error when referencing substitution group with chameleon namespace
> ------------------------------------------------------------------
>
>                 Key: XERCESJ-1577
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1577
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.0 Structures
>    Affects Versions: 2.11.0
>            Reporter: Radu Coravu
>            Assignee: Mukul Gandhi
>
> Tested with the libraries from the Xerces-J 2.11.0-xml-schema-1.1-beta release.
> If I have a small schema in no-namespace like:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
>     <xs:element name="elem" substitutionGroup="p.trans"/>
>     <xs:element name="p.trans" abstract="true"/>
> </xs:schema>
> and a schema which has a target namespaces and includes it:
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="mainNS" xmlns:ns="mainNS">
>     <xs:include schemaLocation="test.xsd"/>
> </xs:schema>
> Validation of the main schema (or of an XML referencing the XML schema) reports the following problem:
> src-resolve.4.1: Error resolving component 'p.trans'. It was detected that 'p.trans' has no namespace, but components with no target namespace are not referenceable from schema document 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'. If 'p.trans' is intended to have a namespace, perhaps a prefix needs to be provided. If it is intended that 'p.trans' has no namespace, then an 'import' without a "namespace" attribute should be added to 'file:/C:/Users/radu_coravu/Desktop/xsdProblem/test.xsd'.
> Basically the reference to a substitution group which is in a chameleon schema is not properly binded once the schema is included from a schema which has a target namespace.
> This worked in Xerces 2.9.1.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

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