- 1. Rationale
- 2. Usage
- 2.1. Config Input
- 2.2. Schema Input
- 2.3. Data Input
- 2.4. Data Output
|
|||||||||||
OPS User Guide
|
Validation Processor
1. RationaleThe validation processor can be inserted in a pipeline to validatate data against a specified schema. The current implementation supports W3C Schema and Relax NG.
The validator functions in two distinct mode. The decorating mode adds
attribute to the document where errors occur. The non-decorating mode throws
a 2. Usage
2.1. Config Input
The configuration input selects the mode of the validator. The validator can
either be in the decorating mode or the non-decorating mode. The
<config> <decorate>true</decorate> </config>
2.2. Schema InputThe validation processor's schema input contains a supported XML schema (W3C or Relax NG). The schema type is automatically recognized. The following example shows a simple Relax NG schema for an arbitrary address book.
<element name="addressBook"> <zeroOrMore> <element name="card"> <element name="name"> <attribute name="age"> <text/> </attribute> <text/> </element> <element name="email"> <text/> </element> </element> </zeroOrMore> </element>
For more information about Relax NG syntax, read the Relax NG specification and Relax NG tutorial. The W3C Schema Primer provides a good introduction to the language. 2.3. Data InputThe data input contains the xml data to be validated. The following document is valid against the address book schema defined above.
<addressBook> <card> <name age="24">John Smith</name> <email>js@example.com</email> </card> <card> <name age="42">Fred Bloggs</name> <email>fb@example.net</email> </card> </addressBook>
2.4. Data Output
If the input data is valid against the specified schema, this output mirrors
the input data, i.e. the validation processor is invisible in the pipeline.
However, when validation errors occur, a
For each validation error, the validator inserts an additional element after
the error-causing element. This element is in the
<v:error message="Error bad character content for element near month (schema: oxf:/date.rng)" system-id="oxf:/date.xml" line="5" column="10" xmlns:v="http://orbeon.org/oxf/xml/validation"/>
|