I just implemented the following EntityResolver, and that fixed my problem..
EntityResolver entityresolver = new EntityResolver() {
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
if (systemId.indexOf("wsu.xsd") != -1) {
InputStream schemaStream = XmlUtil.class.getResourceAsStream("/wsu.xsd");
return new InputSource(schemaStream);
...
} else {
// use the default behaviour
return null;
}
}
};
documentBuilder.setEntityResolver(entityresolver);
Cheers
Simon Vogensen
On 10/30/06, Stanimir Stamenkov <
[EMAIL PROTECTED]> wrote:
/Simon Vogensen/:
> My problem is this: how do I load these schemas from jar resources?
I guess because the jar: URIs are opaque [1], relative resources
can't be resolved automatically so you would need to assign a custom
entity resolver to handle those.
[1] < http://java.sun.com/j2se/1.5.0/docs/api/java/net/URI.html>:
> An opaque URI is an absolute URI whose scheme-specific part does not
> begin with a slash character ('/'). Opaque URIs are not subject to
> further parsing.
--
Stanimir
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
