Closed staskable closed 3 years ago
I managed to solve this issue by setting my self defined URIResolver: https://stackoverflow.com/questions/47226063/resolving-relative-paths-when-using-ph-schematron Hope it can help you.
The problem here is identical: you are using the XSLT doc
function so you CANNOT use the Pure implementation (as it is XPath only). So instead you need to switch to the SchematronResourceSCH" (if you have the .sch file and need to convert it to XSLT first) or
SchemtronResourceXSLT` (if you already have the pre-compiled Schematron-XSLT - e.g. created by the contained Maven plugin).
Setting a custom URI resolver may help here! Thanks Mathias for linking SO, GitHub and Email together :)))
I succeeded using Pure by adding the following to the https://github.com/phax/ph-commons/blob/d4c95abb942185972cfef0484014acdc9edb90e7/ph-xml/src/main/java/com/helger/xml/xpath/XPathHelper.java
try
{
// First try to use Saxon, using the context class loader
aXPathFactory = XPathFactory.newInstance (XPathFactory.DEFAULT_OBJECT_MODEL_URI,
"net.sf.saxon.xpath.XPathFactoryImpl",
ClassLoaderHelper.getContextClassLoader ());
//my contribution
XPathFactoryImpl saxonFactory = (XPathFactoryImpl) aXPathFactory;
saxonFactory.getConfiguration().setURIResolver(new AwesomeClasspathResourceURIResolver());
}
will check it after my vacation. This is Saxon specific but who cares ;)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
The official solution to this, would be (to my understanding) as follows:
XPathConfigBuilder
to build your XPathFactory
of choiceSchematronResourcePure
via setXPathConfig
This should work from v5.5.0 on.
Hi, I m using Pure validation but I have an error when I try to validate
The error is
_07-Nov-2017 07:28:08.870 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 8427 ms 12616 [http-nio-8093-exec-1] ERROR com.helger.schematron.pure.errorhandler.LoggingPSErrorHandler - PSRule - Failed to evaluate XPath expression to a boolean: 'doc(resolve-uri(concat('file:///Users/quest982/testCDA','/',concat('DIZ/XML_PAI_V2/',hl7:code/@codeSystem,'.xml'))))//el[@code=hl7:code/@code]' ; SystemID: ; Line#: 1; Column#: 24 net.sf.saxon.trans.XPathException: I/O error reported by XML parser processing file:///Users/quest982/testCDA/DIZ/XML_PAI_V2/2.16.840.1.113883.6.73.xml: /Users/quest982/testCDA/DIZ/XML_PAIV2/2.16.840.1.113883.6.73.xml (No such file or directory)
The file exists for sure, I think the error is due for the empty value of SystemId. Is there a way to set up SystemId? Or have you got an equivalent solution?
Thanks a lot