Re: Validation...

David Cramer <> 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:

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

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"
  <p:input port="source">
    <p:document href="test/invalid.xml"/>
  <p:output port="result"/>

  <p:import href=""/>

  <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"/>

  <l:relax-ng-report name="validate">
    <p:input port="schema">
      <p:document href="test/rng-schema.rng"/>

  <cx:report-errors name="report-errors">
    <p:input port="source">
      <p:pipe step="validate" port="result"/>
    <p:input port="report">
      <p:pipe step="validate" port="report"/>


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,

Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676

Received on Monday, 2 January 2012 15:30:11 UTC