You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by "John Kaputin (JIRA)" <ji...@apache.org> on 2006/02/02 14:04:03 UTC

[jira] Commented: (WSCOMMONS-1) XmlSchema not resolving schemaLocation with a relative path

    [ http://issues.apache.org/jira/browse/WSCOMMONS-1?page=comments#action_12364951 ] 

John Kaputin commented on WSCOMMONS-1:
--------------------------------------

Testcase: the parent schema resSvc.xsd at the following URL imports another schema credit-card-faults.xsd located at the same base uri.

http://dev.w3.org/cvsweb/~checkout~/2002/ws/desc/test-suite/documents/good/CreditCardFaults-1G/resSvc.xsd

Here is the stack trace:

Exception in thread "main" org.apache.ws.commons.schema.XmlSchemaException: C:\workspace\wsdl20\woden_jktest\credit-card-faults.xsd (The system cannot find the file specified)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:204)
	at org.apache.ws.commons.schema.SchemaBuilder.getXmlSchemaFromLocation(SchemaBuilder.java:1879)
	at org.apache.ws.commons.schema.SchemaBuilder.handleImport(SchemaBuilder.java:1691)
	at org.apache.ws.commons.schema.SchemaBuilder.handleXmlSchemaElement(SchemaBuilder.java:119)
	at org.apache.ws.commons.schema.XmlSchemaCollection.read(XmlSchemaCollection.java:233)
	at jktest.XmlSchemaTest.main(XmlSchemaTest.java:31)

> XmlSchema not resolving schemaLocation with a relative path
> -----------------------------------------------------------
>
>          Key: WSCOMMONS-1
>          URL: http://issues.apache.org/jira/browse/WSCOMMONS-1
>      Project: WS-Commons
>         Type: Bug
>   Components: XmlSchema
>  Environment: Windows XP, JRE 1.42
>     Reporter: John Kaputin

>
> A relative path specified for the schemaLocation on xs:import and xs:include is not being resolved correctly. Seems to be because the base URI is not initialized.
> In this SchemaBuilder method, collection.baseURI is null:
>     XmlSchema getXmlSchemaFromLocation(String schemaLocation) {
>         //check and determine the nature of the schema reference
>         //if it's relative and a base URI is present, then the schema
>         //location needs to be taken by concatanting the base URI with the
>         //relative path
>         String baseURI = collection.baseUri;
>         if (baseURI!=null){
>             if (!isAbsoulte(schemaLocation)){
>                 schemaLocation = baseURI +
>                                  (schemaLocation.startsWith("/")?"":"/")+
>                                  schemaLocation;
>             }
>         }
>         return collection.read(new InputSource(schemaLocation), null);
>     }

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira