xerces-j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gardner, Jeff" <Jeff.Gard...@bestwestern.com>
Subject Included Schemas not found
Date Tue, 22 Apr 2003 00:25:42 GMT
Using Xerces 1.4.4 and the DOM parser I have 2 xsd files /application/xml/x1.xsd and /application/xml/x2.xsd.
  The x1.xsd "includes" the x2.xsd.

x1.xsd
<xs:schema targetNamespace="uri:com.bestwestern.gc" xmlns="uri:com.bestwestern.gc" xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified" attributeFormDefault="unqualified">
     <xs:include schemaLocation="x2.xsd"/>

I have also created an Entity Resolver:
    public InputSource resolveEntity(String publicID, String systemID)
    {
        if (systemID.indexOf("x2.xsd") >= 0)
            systemID = appPath + "/xml/x2.xsd";
            
        InputSource is = new InputSource(systemID);
        System.out.println(" ********** Resovler **********");
        System.out.println(systemID);
        return is;
    }

I receive the xml as a String [like below] so I convert to an InputSource:
   <PointLoad xmlns="uri:com.bestwestern.gc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="uri:com.bestwestern.gc
   /application/xml/x1.xsd">

   InputSource is = new InputSource(new CharArrayReader(xmlStream.toCharArray()));

then parse:

   doc = parser.parse(is);

The output is something like this:

 ********** Resovler **********
/application/xml/x1.xsd
[Warning] :0:0: File "file://application/GCTypes.xsd" not found.

Obviously the entity resolver is not being called when the x1.xsd is being parsed.
I need the application path to be dynamic because the "application" path is different from
Dev to QA to Prod.

How do I resolve the "included" x2.xsd without hard coding the path in the x1.xsd?  Is my
entity resolver wrong?



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


Mime
View raw message