Thanks for the response!

The second solution (EntityResolver) is only valid if I'm using a
SAXParser, correct?  I'm actually using a DOMParser.  Is there an
equivilent at this point?  My search yields that there is an experiemental
version as part of the DOM 3 functionality.

Thanks!
Christian

> > 3) How else can I store schemas, other than placing schemas on a public
> > web site to be accessed by all?  I'd like to explore the option of keeping
> > them locally stored, without hard-coding a complete path to the schema.
> >
>
> You can specify/override which schema to use progmatically.  IE:
> static string EXTERNAL_SCHEMA_PROPERTY =
> "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation";;
> XMLReader xr = new SAXParser();
> xr.setProperty(EXTERNAL_SCHEMA_PROPERTY, "/path/to/schema");
>
> You can use an entity resolver to "find" the schema for you:
> public class MyEntityResolver implements EntityResolver
> {
>     public InputSource resolveEntity(String publicID, String systemID)
> throws SAXException{
>         if (systemID.toLowerCase().endsWith(".xsd")){
>             // Return local copy of the copyright.xml file
>             String target = "/home/richard/dev/import_spec/" + systemID;
>             return new InputSource( target );
>         }
>         // If no match, returning null makes process continue normally
>         return null;
>     }
> }
>
> XMLReader xr = new SAXParser();
> xr.setEntityResolver(new MyEntityResolver());
>
> My problem with the above approach is that my schema has several files
> in it.  The entity resolver is only called once for the "top" level .xsd
> file. The parser then tries to find the other .xsd files which are
> included from the top level schema in the current working directory
> (which fails).  I asked about this behaviour about a week ago on the
> list and got no response, hopefully you will fair better.
>
> --
> Richard Rowell <[EMAIL PROTECTED]>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>

---------------------------------------------------------------------------
 Christian 'xian' Nelson                                  [EMAIL PROTECTED]
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    "Don't ask yourself what the world needs.  Ask yourself what makes
  you come alive, and go do that, because what the world needs is people
                  who have come alive." -- Howard Thurman
---------------------------------------------------------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to