Re: Validation...

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Btw., I worked around the problem by doing a p:xslt in the p:catch and
using an xsl:message terminate="yes" to kill the build and spit out
the error:

http://pastebin.com/XvKwkcUW (line 45ff)

This works fine, but seems an odd way to have to do it. I'd still like
to know what the right way is.

Now to figure out how to pass in a parameter to the pipeline so the
user can control whether validation errors kill the build or not.

Thanks,
David

On 12/23/2011 09:38 PM, David Cramer wrote:
> Hi there, The example below works for me, but I would like to stop
> processing and print the errors to stdout/stderr when the document
> is invalid. I can get it to stop processing by adding a p:error in
> the p:catch:
> 
> http://pastebin.com/K7vNVBqs
> 
> But I haven't figured out how to make it display the error messages
> in any form. Any pointers?
> 
> Thanks, David
> 
> On 11/22/2011 03:13 PM, Norman Walsh wrote:
>> "Imsieke, Gerrit, le-tex" <gerrit.imsieke@le-tex.de> writes:
>>> I had or rather I still have similar issues. I was bothered by 
>>> the fact that Schematron validation provides a "report" port 
>>> which the schema-based validations lack.
>>> 
>>> p:validate-with-relax-ng for example has a single output port 
>>> which will only reproduce the document if it is valid (or if 
>>> @assert-valid="false").
>>> 
>>> In order to catch errors, I wrapped p:validate-with-relax-ng
>>> into a try/catch and forwarded the "error" port of the catch
>>> branch to a "report" output port that I declared for both
>>> branches.
> 
>> Right. And you can wrap that up in a custom step that you reuse 
>> and get just want you want. Here's an example that returns the 
>> validated document and an empty result port or the unvalidated 
>> document and an error report:
> 
>> <p:declare-step type="ex:validate-with-relax-ng" name="main"> 
>> <p:input port="source"/> <p:input port="schema" sequence="true"/>
>>  <p:output port="result" primary="true"> <p:pipe 
>> step="tryvalidation" port="result"/> </p:output> <p:output 
>> port="report" sequence="true"> <p:pipe step="tryvalidation" 
>> port="report"/> </p:output>
> 
>> <p:try name="tryvalidation"> <p:group> <p:output port="result"> 
>> <p:pipe step="xmlvalidate" port="result"/> </p:output> <p:output 
>> port="report" sequence="true"> <p:empty/> </p:output>
> 
>> <p:validate-with-relax-ng name="xmlvalidate"> <p:input 
>> port="source"> <p:pipe step="main" port="source"/> </p:input> 
>> <p:input port="schema"> <p:pipe step="main" port="schema"/> 
>> </p:input> </p:validate-with-relax-ng> </p:group> <p:catch 
>> name="catch"> <p:output port="result"> <p:pipe step="main" 
>> port="source"/> </p:output> <p:output port="report"> <p:pipe 
>> step="id" port="result"/> </p:output> <p:identity name="id"> 
>> <p:input port="source"> <p:pipe step="catch" port="error"/> 
>> </p:input> </p:identity> </p:catch> </p:try> </p:declare-step>
> 
>>> <aside> I just found out that p:validate-with-relax-ng will
>>> only give me the first error. But it’s wrapped in c:errors and
>>> c:error elements, like this:
> 
>> That's a bug. Fixed in github. You'll now get multiple c:error 
>> elements in a c:errors wrapper. I also fixed it in XSD and 
>> improved the report for DTD validation from p:load.
> 
>>> A uniform report port for all types of validation is clearly 
>>> desirable.
> 
>> Indeed.
> 
>> Be seeing you, norm
> 
> 
> 

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJO/yU3AAoJEMHeSXG7afUhBakIAJpybFUTldRFvMMtSZZq9wj/
DadbKtvlnwiD5dTtQ/e3ed8TpsFIFTR/S9+CJiboH23WeNqWDG/OxoEEVlprLMcX
t6e5h2x7I0IFUY4PnKS0FwmGXyog3LJyFdoVgK/g/VSGFQi9Csj0Z2/gPVeiinf5
4EqftctXAJnJ8a2udJNAEm2PAYsR0w3Re41Le+N87j6sMMw7+exsqknEPlK2v37r
y/pxTxw9V9AcvI8yZepyhlBB1UpKQtfEkNvcA1jo0Y7RuZqIWHG2WZ9GZpRATJYK
fQD8F39+8oHquRuupernLE3mjC6sgtsm1E5dwMNlyy4hkfuz51PEl6GUB98+gyU=
=Cxke
-----END PGP SIGNATURE-----

Received on Saturday, 31 December 2011 15:07:59 UTC