You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to create own xsd processor based on xsdparsercore.
publicclassInputStreamXsdProcessorextendsXsdParserCore {
publicInputStreamXsdProcessor(List<InputStream> inputStreams) {
this.parse(inputStreams);
}
publicInputStreamXsdProcessor(List<InputStream> inputStreams, ParserConfigconfig) {
super.updateConfig(config);
this.parse(inputStreams);
}
privatevoidparse(List <InputStream> inputStreams) {
inputStreams.forEach(stream -> parseInputStream(stream));
this.resolveRefs();
}
privatevoidparseInputStream(InputStreaminputStream) {
try {
NodeschemaNode = getSchemaNode(inputStream);
if (isXsdSchema(schemaNode)) {
ConfigEntryDataxsdSchemaConfig = parseMappers.getOrDefault(XsdSchema.XSD_TAG, parseMappers.getOrDefault(XsdSchema.XS_TAG, null));
if (xsdSchemaConfig == null) {
thrownewParserConfigurationException("XsdSchema not correctly configured.");
}
xsdSchemaConfig.parserFunction.apply(newParseData(this, schemaNode, xsdSchemaConfig.visitorFunction));
} else {
thrownewParsingException("The top level element of a XSD file should be the xsd:schema node.");
}
} catch (SAXException | IOException | ParserConfigurationExceptione) {
Logger.getAnonymousLogger().log(Level.SEVERE, "Exception while parsing.", e);
thrownewRuntimeException(e);
}
}
privateNodegetSchemaNode(InputStreaminputStream) throwsParserConfigurationException, IOException, SAXException {
Documentdoc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
doc.getDocumentElement().normalize();
returndoc.getFirstChild();
}
}```
Ihavemultipleproblemswiththis.
1.TheXsdParserCoredesignisbad. Ican't extend simple the XsdParserCore, I must put it to same package...
2.Ican't access the elements and it'sbasedonfiles, notnamespacesandxsdcontent.
3.Inthe `XsdParserCore` wecan't resolve the namespace in the dependent xsd because in the `resolveOtherNamespaceRefs` not based on the xsd targetNamespace, it'sbasedonfiles
The text was updated successfully, but these errors were encountered:
The XsdParserCore wasn't planned to be extended. Currently I don't have much free time to do it so I'll take it in consideration in the future when I'm able to.
I try to create own xsd processor based on xsdparsercore.
The text was updated successfully, but these errors were encountered: