You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ws.apache.org by "Jemini Sam (JIRA)" <ji...@apache.org> on 2011/01/05 15:19:45 UTC
[jira] Created: (WSCOMMONS-565) Relative path in multiple import
include failed when reading a schema
Relative path in multiple import include failed when reading a schema
---------------------------------------------------------------------
Key: WSCOMMONS-565
URL: https://issues.apache.org/jira/browse/WSCOMMONS-565
Project: WS-Commons
Issue Type: Bug
Components: XmlSchema
Affects Versions: XmlSchema 1.4.7
Reporter: Jemini Sam
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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
[jira] [Commented] (XMLSCHEMA-9) Relative path in multiple import
include failed when reading a schema
Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/XMLSCHEMA-9?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13105441#comment-13105441 ]
Daniel Kulp commented on XMLSCHEMA-9:
-------------------------------------
With 2.0, this is somewhat working as designed. The method is called "setBaseUri" for a reason, it needs a URI. new File(sourceXSD).getParent() does not return a URI. If you do: new File(sourceXSD).getParentFile().toURI().toString(), it works fine.
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: XMLSCHEMA-9
> URL: https://issues.apache.org/jira/browse/XMLSCHEMA-9
> Project: XmlSchema
> Issue Type: Bug
> Affects Versions: XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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
[jira] Updated: (WSCOMMONS-565) Relative path in multiple import
include failed when reading a schema
Posted by "Jemini Sam (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WSCOMMONS-565?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jemini Sam updated WSCOMMONS-565:
---------------------------------
Affects Version/s: (was: XmlSchema 1.3.1)
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: WSCOMMONS-565
> URL: https://issues.apache.org/jira/browse/WSCOMMONS-565
> Project: WS-Commons
> Issue Type: Bug
> Components: XmlSchema
> Affects Versions: XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
[jira] Moved: (XMLSCHEMA-9) Relative path in multiple import
include failed when reading a schema
Posted by "Andreas Veithen (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/XMLSCHEMA-9?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andreas Veithen moved WSCOMMONS-565 to XMLSCHEMA-9:
---------------------------------------------------
Component/s: (was: XmlSchema)
Affects Version/s: (was: XmlSchema 1.4.7)
XmlSchema 1.4.7
Key: XMLSCHEMA-9 (was: WSCOMMONS-565)
Project: XmlSchema (was: WS-Commons)
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: XMLSCHEMA-9
> URL: https://issues.apache.org/jira/browse/XMLSCHEMA-9
> Project: XmlSchema
> Issue Type: Bug
> Affects Versions: XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
[jira] [Resolved] (XMLSCHEMA-9) Relative path in multiple import
include failed when reading a schema
Posted by "Daniel Kulp (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/XMLSCHEMA-9?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Daniel Kulp resolved XMLSCHEMA-9.
---------------------------------
Resolution: Duplicate
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: XMLSCHEMA-9
> URL: https://issues.apache.org/jira/browse/XMLSCHEMA-9
> Project: XmlSchema
> Issue Type: Bug
> Affects Versions: XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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
[jira] Updated: (WSCOMMONS-565) Relative path in multiple import
include failed when reading a schema
Posted by "Jemini Sam (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WSCOMMONS-565?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jemini Sam updated WSCOMMONS-565:
---------------------------------
Affects Version/s: XmlSchema 1.3.1
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: WSCOMMONS-565
> URL: https://issues.apache.org/jira/browse/WSCOMMONS-565
> Project: WS-Commons
> Issue Type: Bug
> Components: XmlSchema
> Affects Versions: XmlSchema 1.3.1, XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org
[jira] Updated: (WSCOMMONS-565) Relative path in multiple import
include failed when reading a schema
Posted by "Jemini Sam (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/WSCOMMONS-565?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jemini Sam updated WSCOMMONS-565:
---------------------------------
Attachment: RelativeExample.zip
> Relative path in multiple import include failed when reading a schema
> ---------------------------------------------------------------------
>
> Key: WSCOMMONS-565
> URL: https://issues.apache.org/jira/browse/WSCOMMONS-565
> Project: WS-Commons
> Issue Type: Bug
> Components: XmlSchema
> Affects Versions: XmlSchema 1.4.7
> Reporter: Jemini Sam
> 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.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ws.apache.org
For additional commands, e-mail: dev-help@ws.apache.org