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 have problems with including an xsd file via an import.
My main XSD contains the following import: <xs:import schemaLocation="dependency/second.xsd" namespace="second"/>
The import points to an XSD file located in a subfolder ("dependency") of the folder with the main XSD.
📁resources
|L 📁dependency
| L second.xsd
L main.xsd
Other parsers (for example JAXB) can find and process the other imported second file without problems.
With XsdParser I get the following error when reading my main.xsd:
Sep. 25, 2019 7:41:39 AFTER. org.xmlet.xsdparser.core.XsdParser parseFile
SEVERE: Exception while parsing.
java.io.FileNotFoundException
at org.xmlet.xsdparser.core.XsdParser.parseFile(XsdParser.java:77)
at org.xmlet.xsdparser.core.XsdParser.parse(XsdParser.java:58)
at org.xmlet.xsdparser.core.XsdParser.<init>(XsdParser.java:35)
at Main.main(Main.java:17)
Exception in thread "main" java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:148)
at org.xmlet.xsdparser.core.XsdParserCore.lambda$null$12(XsdParserCore.java:177)
at java.base/java.util.ArrayList.forEach(ArrayList.java:1540)
at org.xmlet.xsdparser.core.XsdParserCore.lambda$resolveInnerRefs$17(XsdParserCore.java:174)
at java.base/java.util.HashMap$KeySet.forEach(HashMap.java:928)
at org.xmlet.xsdparser.core.XsdParserCore.resolveInnerRefs(XsdParserCore.java:164)
at org.xmlet.xsdparser.core.XsdParserCore.resolveRefs(XsdParserCore.java:91)
at org.xmlet.xsdparser.core.XsdParser.parse(XsdParser.java:62)
at org.xmlet.xsdparser.core.XsdParser.<init>(XsdParser.java:35)
at Main.main(Main.java:17)
When I remove the import, parsing works without problems. In the test to the namespaces I have seen that the path is given in relation to the project root. However, it cannot be expected that such path specifications are made in a "normal" XSD. An imported XSD file should (in my opinion) always be searched in relation to the importing XSD file.
By the way, thank you very much for this library! It saves me a lot of work.
The text was updated successfully, but these errors were encountered:
Basically the parser now finds the imported schema. But there is a problem under Windows with the filepath. I fixed that in pull request #13. Problem was the search for slashes. The parentFile path had backslashes under Windows. filePath = parentFile.substring(0, parentFile.lastIndexOf('/') + 1).concat(filePath);
I have fixed the problem by replacing all backslashes in the paths with normal slashes. this.currentFile = filePath.replace("\\", "/");
Hello,
I have problems with including an xsd file via an import.
My main XSD contains the following import:
<xs:import schemaLocation="dependency/second.xsd" namespace="second"/>
The import points to an XSD file located in a subfolder ("dependency") of the folder with the main XSD.
Other parsers (for example JAXB) can find and process the other imported second file without problems.
With XsdParser I get the following error when reading my main.xsd:
When I remove the import, parsing works without problems. In the test to the namespaces I have seen that the path is given in relation to the project root. However, it cannot be expected that such path specifications are made in a "normal" XSD. An imported XSD file should (in my opinion) always be searched in relation to the importing XSD file.
By the way, thank you very much for this library! It saves me a lot of work.
The text was updated successfully, but these errors were encountered: