This sounds strange, I checked the code, the resolver is used. Just make
sure you don't have XmlOptions.setLoadUseDefaultResolver ().

You can also give a try using ResolverUtil.resolverForCatalog().


On Wed, 2012-01-04 at 01:29 -0800, David Svanberg wrote:
> Hi, my problem is that I have legacy XSD Schemas (won't fix) that
> import other schemas using a non-comformant URI as the schemaLocation
> that I want to compile using XmlBeans.compileXsd (using XmlBeans
> 2.5.0). An example import could look like:
> <xs:import namespace="http://www.example.org"; schemaLocation="..\..\My
> Documents"/>
> Please notice that the schemaLocation has no "file://" prefix and
> includes both backslashes and spaces.
> I thought I could use an own EntityResolver to fix the paths but I'm
> not able to get it working. I've tested:
> XmlOptions xmlOpts = new XmlOptions();
> xmlOpts.setEntityResolver(new MyEntityResolver());
> SchemaTypeSystem sts = XmlBeans.compileXsd(new XmlObject[]
> {xmlObject}, XmlBeans.getBuiltinTypeSystem(), xmlOpts);
> But the the resolveEntity method of my MyEntityResolver is never
> beeing called although the javadoc states:
> "If this option is set when compiling a schema, then the given
> EntityResolver will be consulted in order to resolve any URIs while
> downloading imported schemas. EntityResolvers are currently only used
> by compileXsd; they are not consulted by other functions, for example,
> parse. This will likely change in the future."
> The problem must of course be that the schemaLocation is not an URI
> and hence there is an exception somewhere before the resolveEntity is
> getting called. But I want it to consult my resolveEntity before doing
> any URI-checks...
> Am I missing something? How could I proceed or work-around the bad
> schemaLocations?
> Regards,
> David

To unsubscribe, e-mail: user-unsubscr...@xmlbeans.apache.org
For additional commands, e-mail: user-h...@xmlbeans.apache.org

Reply via email to