MOXY problems with EntityResolver for DynamicJAXBContextFactory [message #1753831] |
Fri, 10 February 2017 13:34 |
Sara Nieto Messages: 1 Registered: February 2017 |
Junior Member |
|
|
Dear colleagues,
I would like to use Moxy library and DynamicJAXBContextFactory to read my schema (several XSD files). The problem that I found is that my EntityResolver fails because it tries to import several times the same schema file. To solve this problem of duplicities, I modified the EntityResolver to return NULL, if the schema was already processed, but it still failing....
I tried the same with JAXB and it works perfectly. But I would like to use MOXY due to that I avoid the creation of the Java pojos from the schema.
Could you please let me know how Moxy can lead with a set of schema files and how to import files just once?
Code for EntityResolver:
public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
// Grab only the filename part from the full path
String filename = new File(systemId).getName();
if (!pathMap.containsKey(filename)) {
// Now prepend the correct path
String correctedId = ROUTE + "/" + filename;
InputSource is = new InputSource(ClassLoader.getSystemResourceAsStream(correctedId));
is.setSystemId(correctedId);
pathMap.put(filename, is);
return is;
} else {
return null;
}
}
Thanks a lot in advance!!!
Best regards,
Sara.
|
|
|
Powered by
FUDForum. Page generated in 0.02334 seconds