Page 1 of 1
How to use XSD 1.1 in xProc?
Posted: Sun Feb 11, 2018 8:41 pm
by serioadamo97
Hi,
I use the following xProc file to validate xml.
Code: Select all
<p:declare-step version="1.0" xmlns:p="http://www.w3.org/ns/xproc">
<p:input port="source">
<p:document href="BookStore.xml"/>
</p:input>
<p:output port="result">
<p:pipe step="myValidate" port="result"/>
</p:output>
<p:validate-with-xml-schema assert-valid="true" mode="strict" name="myValidate">
<p:input port="schema">
<p:document href="BookStore.xsd"/>
</p:input>
</p:validate-with-xml-schema>
</p:declare-step>
But if BookStore.xsd is a xsd 1.1 (eg: use xs:all with more than one maxOccuars), then errors occur:
Engine name: Calabash XProc
Severity: error
Description: Within <xs:all>, an <xs:element> must have @maxOccurs equal to 0 or 1
How to use xsd 1.1 in XProc?
Thanks.
Re: How to use XSD 1.1 in xProc?
Posted: Mon Feb 12, 2018 6:47 pm
by adrian
Hi,
What version of Oxygen are you using?
Older versions of Calabash XProc (prior to 2014) could not be configured to use Saxon-EE with a custom configuration. It seems there was a bug in XProc that made it ignore the Saxon config file.
For recent versions, you should copy/edit the file Oxygen\lib\xproc\calabash\lib\saxon.config and add within the
configuration element a line with:
Note that if Oxygen is installed in "Program Files" (it is by default) you will first have to copy the saxon.config file to a folder with write access (e.g. your user profile or desktop), modify it there and then copy it back to its original location, overwriting the existing file.
Regards,
Adrian
Re: How to use XSD 1.1 in xProc?
Posted: Mon Feb 12, 2018 8:03 pm
by serioadamo97
adrian wrote:Hi,
What version of Oxygen are you using?
Older versions of Calabash XProc (prior to 2014) could not be configured to use Saxon-EE with a custom configuration. It seems there was a bug in XProc that made it ignore the Saxon config file.
For recent versions, you should copy/edit the file Oxygen\lib\xproc\calabash\lib\saxon.config and add within the
configuration element a line with:
Note that if Oxygen is installed in "Program Files" (it is by default) you will first have to copy the saxon.config file to a folder with write access (e.g. your user profile or desktop), modify it there and then copy it back to its original location, overwriting the existing file.
Regards,
Adrian
It works now, very thanks.
But I have another question:
How to make XProc to prompt detail information, when schema validate failed? (eg: line number and element name in source document)
I use the XProc file below,
when source document is valid, it will print the document,
but if source document is invalid, it will report dynamic error instead of detail infomation.
Description: err:XC0053 : XProc error err:XC0053 It is a dynamic error if the assert-valid option is true and the input document is not valid. One or more validation errors were reported
Re: How to use XSD 1.1 in xProc?
Posted: Tue Feb 13, 2018 1:38 pm
by adrian
Hi,
I'm afraid I don't have a solution for this one. I've searched around the web, but can't find anything in this regard. This is between XML Calabash and Saxon-EE. It could be that it's not possible to obtain more detailed information about the error with XProc.
The
XProc specs mention that:
It is a dynamic error (err:XC0053) if the assert-valid option is true and the input document is not valid. If the assert-valid option is false, it is not an error for the document to be invalid. In this case, if the implementation does not support the PSVI, p:validate-with-xml-schema is essentially just an “identity” step, but if the implementation does support the PSVI, then the resulting document will have additional type information (at least for the subtrees that are valid).
The last part indicates the PSVI info may not necessarily be useful in case of an error. But again, not sure if XMLCalabash+Saxon-EE support PSVI and even if supporting PSVI could provide detailed error info.
Regards,
Adrian