I am using relaxNG and Jing (relaxNG validator in Java) for validating some XML files and I need to merge grammars (reuse of element definitions in two grammars).
To achieve the merge I include a grammar with the element and I give the href attribute the value of the included grammar file:
<include href="embededGrammar.xml"/>
All grammar files are located at the same path in the resources of my Java project.
When testing the application within the IDE the included grammar in found and my XML data files are validated.
But when I package the application to a JAR file the embedded grammar is not found and the error message reports that it tries to find it at the same location than the jar file (not in the jar file at the same place than the embedding grammar as it should).
I have implemented a workaround but I would like to implement a clean solution therefore if anybody solved such an issue please let me know how.
Thanks.
EDIT:it is working fine if I hard code the href value to point to the file inside the jar file (jar:file:./jarfile.jar/path/to/file/ebeddedGrammar.xml) but jar file name may change (version number is appended) moreover it is then not possible to test within the IDE.