Proposal for XProc: add output port to p:validate-with-xml-schema

Good morning,

In my experience the primary purpose for using XML Schema (and other
validation languages) is to determine if the incoming XML document is valid.
A typical use case would be:

1) Validate XML.
2) Process XML.
    a) If valid, then process it normally (e.g., store in dB).
    b) If not, then handle the errors gracefully.

It is my opinion that p:validate-with-xml-schema needs to have a very simple
mechanism for the pipeline author to access whether or not the schema is
valid.  To that end, I make three proposals:

#1) I propose making an addition to the declaration of
p:validate-with-xml-schema by adding an output port as follows:

    <p:output port="valid" primary="false"/>

The output could be similar to the output of p:compare:

   <c:result>true</c:result>

or 

  <c:result>false</c:result>

#2) I propose that if validation fails, then the error messages from the
schema processor be captured and returned as part of the <c:result>.  This
could be done any of a number of ways, and I have no real preference.  It
could be as an attribute:

  <c:result error="...error messages go here...">false</c:result>

It could be as an element:
 
   <c:result>
      <valid>false</valid>
      <errors>...error messages go here..</errors>
  </c:result>

#3) I propose that similar additions be made to the other validation steps,
p:validate-with-schematron and p:validate-with-relax-ng.

Thank for considering my proposals,

James Garriss
http://garriss.blogspot.com

Received on Friday, 26 September 2008 16:39:12 UTC