XML Validator Node
- Function provided
-
The XML Validator Node provides the functionality to perform validation of XML
messages against schemas.
A message received on the input terminal is passed to the Xerces parser for
validation. If no errors are encountered, the message is propagated to the Out
terminal, untouched. If errors are reported by the parser, the errors are passed
back to the message flow in the Environment tree, along with the untouched message to the
Invalid terminal.
The message bitstream is passed to the parser for validation, and therefore any message
format (e.g. XML, XMLNS, BLOB etc.) can be validated, as long as the physical representation
of the message is XML.
Configurable parameters are provided to allow the schema files to be overridden
for XML documents with namespaces, and those without.
- Basic Parameters
-
Schema Location - This maps to the Xerces property http://apache.org/xml/properties/schema/external-schemaLocation
(see http://xml.apache.org/xerces2-j/properties.html)
Forces the parser to override the instance xsi:schemaLocation1 attribute, and use the value
supplied (i.e. ignore the document xsi:schemaLocation). This property can also be used to set the
schema if the attribute is not present in the document. The value is the same syntax as an
xsi:schemaLocation attribute, and may be a list of namespace and schema document location pairs,
separated by a space, e.g.:
namespace1 file:///c:/xsd1.xsd namespace2 http://www.ibm.com/xsd2.xsd
To specify a schema on the filesystem, the file must be available to the broker, and specifed using
the URI prefix file:///c:/, for example. It is also possible to use the URI prefix http:// to
reference remote schemas that are accessible via the http protocol from the broker.
-
No Namespace Schema Location - This maps to the Xerces property "http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
(see http://xml.apache.org/xerces2-j/properties.html)
Similar to the Schema Location node attribute. This forces the parser to override the value of
xsi:noNamespaceSchemaLocation1 found in an XML document, and use the schema specified. This property
can also be used to set the schema if the attribute is not present in the document. Only one value can
be provided, and is in the form of a filename.
To specify a schema on the filesystem, the file must be available to the broker, and specifed using
the URI prefix file:///c:/, for example. It is also possible to use the URI prefix http:// to
reference remote schemas that are accessible via the http protocol from the broker.
-
Ignore Warnings - Tells the node not to treat warnings reported by Xerces
as errors. Warnings will not be reported in the Environment tree, and
messages containing only warnings will propagate to the Out terminal.
-
Full Schema Check - Tells the parser to perform full grammar constraint
checking of the schema itself, which may be time consuming.
- Advanced Parameters
-
Enable Logging - A checkbox to enable or disable logging output from the node.
-
Log Filename - Enables the log output to be redirect to a file. If left blank, the log
is output to the standard output. To view this output on the Windows operating system, open
the services control panel applet, and modify the broker service to Log On as the system account,
and enable it to interact with the desktop.
- Input
-
A message in any domain may be passed into the node. The last child element
of the Message Root tree is taken as the message body (equivalent to the InputBody
element in Compute node ESQL). This is then converted into a bitstream, before
being passed to the Xerces XML parser.
If no schema properties are set, the schema specified in the XML document is used to
validate the document. The schema values can be overridden by either specifying values
in the message flow, or by setting message flow variables as a message is being processed.
The different methods are outlined in the following list, in order of precedence.
-
Schema Location
- Message flow node settings
- LocalEnvironment.XMLValidator.SchemaLocation
- Environment.XMLValidator.SchemaLocation
-
No Namespace Schema Location
- Message flow node settings
- LocalEnvironment.XMLValidator.NoNamespaceSchemaLocation
- Environment.XMLValidator.NoNamespaceSchemaLocation
- Output
-
If there are no validation errors, the message is passed unchanged to the
Out terminal. If errors do occur, the Root tree of the message is passed unchanged
to the Invalid terminal, and errors are reported in the Environment tree, in the
Environment.XMLValidationErrors.Error[] location. Multiple Error elements may be returned,
if more than one error is found.