You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Hudson (JIRA)" <ji...@apache.org> on 2011/09/15 21:06:09 UTC

[jira] [Commented] (XMLSCHEMA-8) Relative path in multiple import/include failed when reading a schema

    [ https://issues.apache.org/jira/browse/XMLSCHEMA-8?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105609#comment-13105609 ] 

Hudson commented on XMLSCHEMA-8:
--------------------------------

Integrated in xmlschema-trunk-jdk15 #16 (See [https://builds.apache.org/job/xmlschema-trunk-jdk15/16/])
    [XMLSCHEMA-8] Fix problem with relative paths if a file URI is passed in
for system location.

dkulp : 
Files : 
* /webservices/xmlschema/trunk/xmlschema-core/src/main/java/org/apache/ws/commons/schema/resolver/DefaultURIResolver.java
* /webservices/xmlschema/trunk/xmlschema-core/src/test/java/tests/ImportTest.java
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a/b
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a/b/c
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a/b/c/s1.xsd
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a/b/s2.xsd
* /webservices/xmlschema/trunk/xmlschema-core/src/test/resources/XMLSCHEMA-8/a/b/s3.xsd


> Relative path in multiple import/include failed when reading a schema
> ---------------------------------------------------------------------
>
>                 Key: XMLSCHEMA-8
>                 URL: https://issues.apache.org/jira/browse/XMLSCHEMA-8
>             Project: XmlSchema
>          Issue Type: Bug
>    Affects Versions: XmlSchema 1.4.7
>            Reporter: Jemini Sam
>            Assignee: Daniel Kulp
>             Fix For: XmlSchema 2.0.1
>
>         Attachments: RelativeExample.zip
>
>
> When we want to load a schema with import/include on cascade, if the *schemaLocation* is a relative path, the *SchemaBuilder* class fails to find schemas which aren't in the same directory of the schema to load.
> For example, if we have 3 schemas :
> - s1.xsd in directory a/b/c which imports s2.xsd in a/b
> - and s2.xsd which includes or imports s3.xsd in the same directory
> a/b/c/s1.xsd
> a/b/s2.xsd
> a/b/s3.xsd
> And we want to read the schema s1.xsd :
> {code}
> String sourceXSD = "resources/schemas/a/b/c/s1.xsd";
> InputStream is;
> try {
> 	is = new FileInputStream(sourceXSD);
> 	XmlSchemaCollection schemaCol = new XmlSchemaCollection();
> 	schemaCol.setBaseUri(new File(sourceXSD).getParent().replaceAll("\\\\", "/"));
> 	DefaultURIResolver schemaResolver = (DefaultURIResolver) schemaCol.getSchemaResolver();
> 	System.out.println("schemaResolver.toString(): " + schemaResolver.getCollectionBaseURI());
> 	XmlSchema schema = schemaCol.read(new StreamSource(is), null);
> } catch (FileNotFoundException e) {
> 	e.printStackTrace();
> }
> {code}
> We have an exception on s3.xsd schema which is not found in directory a/b/c.
> See the sources of the example attached.

--
This message is automatically generated by JIRA.
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