You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Fergus Gallagher <Fe...@OrbisUK.com> on 2000/10/03 12:35:34 UTC
Problems with custom EntityResolver
I have an XML doc with
<!DOCTYPE root SYSTEM "my.dtd">
and I want to intercept the systemId to load it from a custom location so I
set a custom EntityResolver as:
-----
processor = XSLTProcessorFactory.getProcessor();
XMLParserLiaison parserLiaison= processor.getXMLProcessorLiaison();
parserLiaison.setEntityResolver(new MyResolver());
....
private class MyResolver implements EntityResolver {
public InputSource resolveEntity
(String publicId, String systemId) {
System.out.println("resolving "+systemId);
....
}
}
------
My problem is that the passed systemId is
<base-URL-of-XML>/my.dtd (e.g., file:xml/my.dtd)
rather than just the raw string "my.dtd"
This make custom entity resolution problematic as the systemId is lot
location independent. Does anyone have any suggestions as to a better way
to do this? The hack to strip out everything after the last "/" is
certainly sub-optimal.
Thanks
Fergus
--
Fergus Gallagher
Orbis
http://www.orbisuk.com/
+44-(0)20-8987 0717