You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Murali Gunasekaran (Created) (JIRA)" <ji...@apache.org> on 2012/02/24 18:31:48 UTC

[jira] [Created] (XMLSCHEMA-20) Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value

Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value
----------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: XMLSCHEMA-20
                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-20
             Project: XmlSchema
          Issue Type: Bug
    Affects Versions: XmlSchema 2.0.1, XmlSchema 1.4.4, XmlSchema 1.4.7
            Reporter: Murali Gunasekaran


If a schema imports another schema that doesn't have a targetNamespace declared, then the <import/> element is getting generated with an empty valued 'namespace' attribute. It is expected that the namespace attribute will not be declared, since it is not present in the original schema and also because the targetNamespace is not declared in the imported schema.

Per the XMLSchema spec,

<pre>
4.2.3 References to schema components across namespaces
Schema Representation Constraint: Import Constraints and Semantics
...

3 The appropriate case among the following must be true:
3.1 If there is a namespace [attribute], then its - actual value-  must be identical to the - actual value-  of the targetNamespace [attribute] of SII.
3.2 If there is no namespace [attribute], then SII must have no targetNamespace [attribute]

</pre>

Repro Steps:
---
Consider the following 3 simple schemas:

Order1.xsd:
---
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           targetNamespace="http://example.org/ord"
           xmlns="http://example.org/ord">
         

    <xs:include schemaLocation="order2.xsd"/>  
    <xs:import schemaLocation="dummy.xsd"/>

    <xs:element name="order" type="OrderType"/>
    <xs:complexType name="OrderType">
        <xs:sequence>
            <xs:element name="number" type="OrderNumType"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>


Order2.xsd:
----

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns="http://example.org/ord"
           targetNamespace="http://example.org/ord">

    <xs:simpleType name="OrderNumType">
        <xs:restriction base="xs:string"/>
    </xs:simpleType>

</xs:schema>

Dummy.xsd:
---
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></xs:schema>


Loading Order1.xsd and serializing it back results in this import statement:

<xs:import namespace="" schemaLocation="dummy.xsd"/>

(Note the namespace attribute with "" value).



Simple JUnit Code:
---

 @Test
    public void testSerializeSchema() throws Exception {
        String schPath = "order1.xsd";
        File schFile = new File(getClass().getResource(schPath).toURI());
        assertTrue(schFile.exists());

        FileReader fr = new FileReader(schFile);
        XmlSchemaCollection schColl = new XmlSchemaCollection();
        schColl.setBaseUri(schFile.getAbsolutePath());

        XmlSchema schema = schColl.read(fr);
        schema.write(System.out);
    }

--
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: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Resolved] (XMLSCHEMA-20) Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value

Posted by "Daniel Kulp (Resolved) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/XMLSCHEMA-20?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Kulp resolved XMLSCHEMA-20.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.2
         Assignee: Daniel Kulp
    
> Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-20
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-20
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: XmlSchema 1.4.4, XmlSchema 1.4.7, XmlSchema 2.0.1
>            Reporter: Murali Gunasekaran
>            Assignee: Daniel Kulp
>             Fix For: 2.0.2
>
>
> If a schema imports another schema that doesn't have a targetNamespace declared, then the <import/> element is getting generated with an empty valued 'namespace' attribute. It is expected that the namespace attribute will not be declared, since it is not present in the original schema and also because the targetNamespace is not declared in the imported schema.
> Per the XMLSchema spec,
> <pre>
> 4.2.3 References to schema components across namespaces
> Schema Representation Constraint: Import Constraints and Semantics
> ...
> 3 The appropriate case among the following must be true:
> 3.1 If there is a namespace [attribute], then its - actual value-  must be identical to the - actual value-  of the targetNamespace [attribute] of SII.
> 3.2 If there is no namespace [attribute], then SII must have no targetNamespace [attribute]
> </pre>
> Repro Steps:
> ---
> Consider the following 3 simple schemas:
> Order1.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            targetNamespace="http://example.org/ord"
>            xmlns="http://example.org/ord">
>          
>     <xs:include schemaLocation="order2.xsd"/>  
>     <xs:import schemaLocation="dummy.xsd"/>
>     <xs:element name="order" type="OrderType"/>
>     <xs:complexType name="OrderType">
>         <xs:sequence>
>             <xs:element name="number" type="OrderNumType"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:schema>
> Order2.xsd:
> ----
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            xmlns="http://example.org/ord"
>            targetNamespace="http://example.org/ord">
>     <xs:simpleType name="OrderNumType">
>         <xs:restriction base="xs:string"/>
>     </xs:simpleType>
> </xs:schema>
> Dummy.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></xs:schema>
> Loading Order1.xsd and serializing it back results in this import statement:
> <xs:import namespace="" schemaLocation="dummy.xsd"/>
> (Note the namespace attribute with "" value).
> Simple JUnit Code:
> ---
>  @Test
>     public void testSerializeSchema() throws Exception {
>         String schPath = "order1.xsd";
>         File schFile = new File(getClass().getResource(schPath).toURI());
>         assertTrue(schFile.exists());
>         FileReader fr = new FileReader(schFile);
>         XmlSchemaCollection schColl = new XmlSchemaCollection();
>         schColl.setBaseUri(schFile.getAbsolutePath());
>         XmlSchema schema = schColl.read(fr);
>         schema.write(System.out);
>     }

--
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: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (XMLSCHEMA-20) Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value

Posted by "Hudson (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/XMLSCHEMA-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13244312#comment-13244312 ] 

Hudson commented on XMLSCHEMA-20:
---------------------------------

Integrated in xmlschema-trunk-jdk15 #20 (See [https://builds.apache.org/job/xmlschema-trunk-jdk15/20/])
    [XMLSCHEMA-20] Fix problem of serialized import elements always having
a targetNamespace attribute that may be empty. (Revision 1308398)

     Result = SUCCESS
dkulp : 
Files : 
* /webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/XmlSchemaSerializer.java
* /webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/IncludeTest.java
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-20
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-20/test.xsd
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-20/test2.xsd
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-20/test3.xsd

                
> Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-20
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-20
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: XmlSchema 1.4.4, XmlSchema 1.4.7, XmlSchema 2.0.1
>            Reporter: Murali Gunasekaran
>            Assignee: Daniel Kulp
>             Fix For: 2.0.2
>
>
> If a schema imports another schema that doesn't have a targetNamespace declared, then the <import/> element is getting generated with an empty valued 'namespace' attribute. It is expected that the namespace attribute will not be declared, since it is not present in the original schema and also because the targetNamespace is not declared in the imported schema.
> Per the XMLSchema spec,
> <pre>
> 4.2.3 References to schema components across namespaces
> Schema Representation Constraint: Import Constraints and Semantics
> ...
> 3 The appropriate case among the following must be true:
> 3.1 If there is a namespace [attribute], then its - actual value-  must be identical to the - actual value-  of the targetNamespace [attribute] of SII.
> 3.2 If there is no namespace [attribute], then SII must have no targetNamespace [attribute]
> </pre>
> Repro Steps:
> ---
> Consider the following 3 simple schemas:
> Order1.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            targetNamespace="http://example.org/ord"
>            xmlns="http://example.org/ord">
>          
>     <xs:include schemaLocation="order2.xsd"/>  
>     <xs:import schemaLocation="dummy.xsd"/>
>     <xs:element name="order" type="OrderType"/>
>     <xs:complexType name="OrderType">
>         <xs:sequence>
>             <xs:element name="number" type="OrderNumType"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:schema>
> Order2.xsd:
> ----
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            xmlns="http://example.org/ord"
>            targetNamespace="http://example.org/ord">
>     <xs:simpleType name="OrderNumType">
>         <xs:restriction base="xs:string"/>
>     </xs:simpleType>
> </xs:schema>
> Dummy.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></xs:schema>
> Loading Order1.xsd and serializing it back results in this import statement:
> <xs:import namespace="" schemaLocation="dummy.xsd"/>
> (Note the namespace attribute with "" value).
> Simple JUnit Code:
> ---
>  @Test
>     public void testSerializeSchema() throws Exception {
>         String schPath = "order1.xsd";
>         File schFile = new File(getClass().getResource(schPath).toURI());
>         assertTrue(schFile.exists());
>         FileReader fr = new FileReader(schFile);
>         XmlSchemaCollection schColl = new XmlSchemaCollection();
>         schColl.setBaseUri(schFile.getAbsolutePath());
>         XmlSchema schema = schColl.read(fr);
>         schema.write(System.out);
>     }

--
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: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org


[jira] [Commented] (XMLSCHEMA-20) Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value

Posted by "Murali Gunasekaran (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/XMLSCHEMA-20?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13273583#comment-13273583 ] 

Murali Gunasekaran commented on XMLSCHEMA-20:
---------------------------------------------

Hi Dan,
Thanks for making the fix for this issue on the 2.0.x branch. Is there any chance we can get the same fix on top of 1.4.x? We are still using 1.4.4 and since 2.0 is not backward compatible with 1.4, we are unable to switch immediately (though we have plans to upgrade later this year).

Please advise.
Murali
                
> Serializing an XmlSchema that imports another schema that doesn't have targetNamespace results in the import having a namespace attribute with empty value
> ----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-20
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-20
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: XmlSchema 1.4.4, XmlSchema 1.4.7, XmlSchema 2.0.1
>            Reporter: Murali Gunasekaran
>            Assignee: Daniel Kulp
>             Fix For: 2.0.2
>
>
> If a schema imports another schema that doesn't have a targetNamespace declared, then the <import/> element is getting generated with an empty valued 'namespace' attribute. It is expected that the namespace attribute will not be declared, since it is not present in the original schema and also because the targetNamespace is not declared in the imported schema.
> Per the XMLSchema spec,
> <pre>
> 4.2.3 References to schema components across namespaces
> Schema Representation Constraint: Import Constraints and Semantics
> ...
> 3 The appropriate case among the following must be true:
> 3.1 If there is a namespace [attribute], then its - actual value-  must be identical to the - actual value-  of the targetNamespace [attribute] of SII.
> 3.2 If there is no namespace [attribute], then SII must have no targetNamespace [attribute]
> </pre>
> Repro Steps:
> ---
> Consider the following 3 simple schemas:
> Order1.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            targetNamespace="http://example.org/ord"
>            xmlns="http://example.org/ord">
>          
>     <xs:include schemaLocation="order2.xsd"/>  
>     <xs:import schemaLocation="dummy.xsd"/>
>     <xs:element name="order" type="OrderType"/>
>     <xs:complexType name="OrderType">
>         <xs:sequence>
>             <xs:element name="number" type="OrderNumType"/>
>         </xs:sequence>
>     </xs:complexType>
> </xs:schema>
> Order2.xsd:
> ----
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
>            xmlns="http://example.org/ord"
>            targetNamespace="http://example.org/ord">
>     <xs:simpleType name="OrderNumType">
>         <xs:restriction base="xs:string"/>
>     </xs:simpleType>
> </xs:schema>
> Dummy.xsd:
> ---
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"></xs:schema>
> Loading Order1.xsd and serializing it back results in this import statement:
> <xs:import namespace="" schemaLocation="dummy.xsd"/>
> (Note the namespace attribute with "" value).
> Simple JUnit Code:
> ---
>  @Test
>     public void testSerializeSchema() throws Exception {
>         String schPath = "order1.xsd";
>         File schFile = new File(getClass().getResource(schPath).toURI());
>         assertTrue(schFile.exists());
>         FileReader fr = new FileReader(schFile);
>         XmlSchemaCollection schColl = new XmlSchemaCollection();
>         schColl.setBaseUri(schFile.getAbsolutePath());
>         XmlSchema schema = schColl.read(fr);
>         schema.write(System.out);
>     }

--
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: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org