- From: Norman Walsh <ndw@nwalsh.com>
- Date: Mon, 02 Jan 2012 10:29:39 -0500
- To: XProc Dev <xproc-dev@w3.org>
- Message-ID: <m2fwfyt95o.fsf@nwalsh.com>
David Cramer <david@thingbag.net> writes: > But I haven't figured out how to make it display the error messages in > any form. Any pointers? Ok. I've added two steps to the XProc library: http://xproc.org/library/#relax-ng-report http://xproc.org/library/#xml-schema-report These two steps perform RELAX NG or XML Schema validation returning two results: the (possibly) validated document and a report of errors. Combined with the extension step cx:report-errors http://xmlcalabash.com/docs/reference/cx-report-errors.html it's now possible to perform all of these operations: 1. Abort on validation error 2. Silently ignore validation error 3. Ignore validation errors, but make sure that the errors are reported to the user Here's a pipeline that does 3: <p:declare-step version='1.0' name="main" xmlns:cx="http://xmlcalabash.com/ns/extensions" xmlns:p="http://www.w3.org/ns/xproc" xmlns:l="http://xproc.org/library" xmlns:ex="http://xproc.org/ns/xproc/ex"> <p:input port="source"> <p:document href="test/invalid.xml"/> </p:input> <p:output port="result"/> <p:import href="http://xproc.org/library/relax-ng-report.xpl"/> <p:declare-step type="cx:report-errors"> <p:input port="source" primary="true"/> <p:input port="report" sequence="true"/> <p:output port="result"/> <p:option name="code"/> <p:option name="code-prefix"/> <p:option name="code-namespace"/> </p:declare-step> <l:relax-ng-report name="validate"> <p:input port="schema"> <p:document href="test/rng-schema.rng"/> </p:input> </l:relax-ng-report> <cx:report-errors name="report-errors"> <p:input port="source"> <p:pipe step="validate" port="result"/> </p:input> <p:input port="report"> <p:pipe step="validate" port="report"/> </p:input> </cx:report-errors> </p:declare-step> Does this cover all of the use cases? (I'm not asking if you think this is a *good* solution, I'm just trying to see if we've technically covered all the bases or if there's still more that I'm not getting.) Be seeing you, norm -- Norman Walsh Lead Engineer MarkLogic Corporation Phone: +1 413 624 6676 www.marklogic.com
Received on Monday, 2 January 2012 15:30:11 UTC