Re: Unable to get a failed schema validation to output "invalid"

"Costello, Roger L." <costello@mitre.org> writes:
> I am trying to write a pipeline that validates an XML document
> against an XML Schema. It validation succeeds, output the XML
> document. If validation fails, output the string "invalid".
>
> Below is the pipeline I wrote. It seems to work as I want when the
> XML document is valid (i.e. it outputs the XML document). But when
> the XML document is not valid, it does not behave as I want. Instead
> of outputting the string "invalid" it generates an error message.
>
> What am I doing wrong please?  /Roger
>
> <p:declare-step xmlns:p="http://www.w3.org/ns/xproc"
>                 xmlns:c="http://www.w3.org/ns/xproc-step">
>         <p:input port="source">
>             <p:document href="BookStore.xml"/>
>         </p:input>
>         <p:output port="result" />
>
>     <p:try>
>         <p:group>
>             <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:identity>
>                 <p:input port="source">
>                     <p:pipe step="myValidate" port="result"/>
>                     </p:input>
>             </p:identity>

That identity step is redundant, I think.

>         </p:group>
>         <p:catch>
>             <p:identity>
>                 <p:input port="source">
>                     <p:inline><c:result>invalid</c:result></p:inline>
>                     </p:input>
>             </p:identity>
>         </p:catch>
>     </p:try>
>
> </p:declare-step>

It looks right to me. 

(1) What error message does it generate for you?
(2) Can you provide the document and schema?
(3) Can you show us the command line that you're using?

                                        Be seeing you,
                                          norm

-- 
Norman Walsh <ndw@nwalsh.com> | Childishness follows us all the days of
http://nwalsh.com/            | our life. If anybody seems wise it is
                              | only because his follies are in keeping
                              | with his age and circumstances.--La
                              | Rochefoucauld

Received on Friday, 5 December 2008 00:49:18 UTC