Re: Validation...

David Cramer <david@thingbag.net> writes:
> 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:

Are you using Saxon to do the validation, or Xerces?

If I run this pipeline with Saxon validation:

<p:declare-step version='1.0' name="main"
		xmlns:p="http://www.w3.org/ns/xproc"
		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:try>
    <p:group>
      <p:validate-with-xml-schema>
        <p:input port="schema">
          <p:document href="test/xsd-schema.xsd"/>
        </p:input>
      </p:validate-with-xml-schema>
    </p:group>
    <p:catch name="catch">
      <p:error code="ex:foo">
        <p:input port="source">
          <p:pipe step="catch" port="error"/>
        </p:input>
      </p:error>
    </p:catch>
  </p:try>
</p:declare-step>

I get reasonable looking errors on stderr:

tvdinner:/Volumes/Data/github/calabash$ calabash -D pipe.xpl
----------------------------------------------------------------------
Validation error on line 1 column 54 of invalid.xml:
  XTTE1510: Attribute @bar is not allowed on element <doc> (See
  http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 3)
Validation error on line 1 column 54 of invalid.xml:
  XTTE1510: Required attribute @foo is missing (See
  http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 4)
Validation error on line 2 column 16 of invalid.xml:
  XTTE1510: Attribute @foo is not allowed on element <p> (See
  http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 3)
Validation error on line 2 column 16 of invalid.xml:
  XTTE1510: Required attribute @bar is missing (See
  http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 4)
Validation error on line 3 column 12 of invalid.xml:
  XTTE1510: In content of element <p>: The content model does not allow element <fred> to
  appear here. Expected: em (See http://www.w3.org/TR/xmlschema-1/#cvc-complex-type clause 2.4)
Validation error on line 5 column 7 of invalid.xml:
  XTTE1510: One or more validation errors were reported
SEVERE: ex:foo:
SEVERE: Unknown error

Is that not what you get?

With Xerces, the errors don't appear. That's a bug, but Xerces validation is
pretty sketchy so it's probably not the only bug.

                                        Be seeing you,
                                          norm

-- 
Norman Walsh
Lead Engineer
MarkLogic Corporation
Phone: +1 413 624 6676
www.marklogic.com

Received on Saturday, 31 December 2011 15:53:04 UTC