validateRNGvalidateRNG
Validate XML using relaxNG
Home > Books > NetKernel API and Services Reference > Accessor Listing > XML Accessors > validateRNG

Rate this page:
Really useful
Satisfactory
Not helpful
Confusing
Incorrect
Unsure
Extra comments:


Module

urn:org:ten60:netkernel:ext:xml:ura

The validateRNG accessor is exported by the urn:org:ten60:netkernel:ext:xml:ura module. Import this module to gain access to the accessor.

Syntax

URI
active:validateRNG

ArgumentRulesDescription
operandMandatory the resource to be validated
operatorMandatory the resource holding the RNG schema
paramOptional optional parameters

Example Usage

DPML

<instr>
  <type>validateRNG</type>
  <operand>foo.xml</operand>
  <operator>bar.rng</operator>
  <target>this:response</target>
</instr>

NetKernel Foundation API

req=context.createSubRequest("active:validateRNG");
req.addArgument("operand", [resource representation, aspect, or URI] );
req.addArgument("operator", [resource representation, aspect, or URI] );
result=context.issueSubRequest(req);

Purpose

The validateRNG accessor is used to validate the operand against a RelaxNG schema operator document. RelaxNG is an OASIS standard schema language. Unlike XML schema it is easy to learn and can be easily read.

A document can be validated several times in a processing pipeline and against different or even dynamically generated schema. Validation can be the basis for pipeline branches.

validateRNG returns a canonical boolean document <b>t</b> true, or <b>f</b> false. If an error occurs in validation an error element is appended to the boolean response. By default the RNG validator will attempt to return an XPath reference to the source of the error - see param syntax below for override.

Parameter Syntax

validateRNG takes an optional parameter document with arguments for the validation engine.

<validateRNG>
  <processErrorsOff />
  <feasible />
</validateRNG>

processErrorsOff Disble error processing for generating XPath locations to the error. Xpath Error Processing is enabled by default and can be turned off for a small increase in performance. However if the document is valid there is no adavantage to turning off error processing.

feasible Feasible validation.

validateRNG is implemented using James Clarke's Jing validator. This supports an optional mode to Feasibly validate a document, here's the Jing description:

"Checks that the document is feasibly valid. A document is feasibly valid if it could be transformed into a valid document by inserting any number of attributes and child elements anywhere in the tree. This is equivalent to transforming the schema by wrapping every data, list, element and attribute element in an optional element and then validating against the transformed schema. This option may be useful while a document is still under construction. This option also disables checking that for every IDREF there is a corresponding ID."

References

validateXSD
validateSchematron

© 2003-2007, 1060 Research Limited. 1060 registered trademark, NetKernel trademark of 1060 Research Limited.