afs_xml_validate - AFS - Reference Guides

AFS Filters Description

Product
AFS
Platform
7.12
Category
Reference Guides
Language
English

The xml validation filter decides whether a received document is XML-valid. When the document is XML-valid, it is passed to the next filter (without any modification). Otherwise, the document is stopped. The default verification verifies the XML syntax. However semantic verification is possible using DTD or XSD.

The filter is declared with the afs_xml_validate type. It is in the antidot-paf package. It is a processor filter.

This filter can be instantiated only once at any given moment. It will not read the "instances" parameter in the configuration.

The XML Validation filter specifications are described in the following table:

Parameter name

Mandatory

Type

Default

Description

dtd_uri

No

file

No DTD validation

DTD uri, triggering DTD-based validation

file_mode

No

boolean

false

Use this option (set it to true) to process large XML file. See warning for associated limitations.

input_layer

No

layer

CONTENTS

It is the input layer containing the XML content to be validated.

xsd_uri

No

file

No XSD validation

XSD uri, triggering XSD-based validation

xml_catalogs

No

file_list

N/A

If the use of a specific validation catalog is needed (catalog not present in /usr/local/afs7/share/xml), use this parameter to load it.

When setting file_mode parameter to true, the filter process documents directly from the disk, then following limitations apply:
  • XSD/DTD validation is not available anymore.
  • Only "FILE" URIs (and not urn:afs:xxx and so on) can be processed.
  • Layers content is not read, only disk content associated to URI is.

The XML parser is different depending to value of dtd_uri and xsd_uri parameters:
  • If both parameters have no value, the parser will be SAX.
  • If one or both parameters have a value, the parser will be DOM.
Note: It is advised to use the file_mode parameter with large files (if process failed because file is too large).
A default AFS catalog is bundled in /usr/local/afs7/share/xml. It contains several XSD and links that can be used without network request. It enables offline XML validation thanks to XML schema catalogs.
Tip: afs_xml_validate filter does not access the Internet. Any validation of an external link that cannot be resolved via an offline catalog will result in a parsing error. This error is visible in the filter log, with a log level of 2.
Note: For more information about creating an offline validation catalog and its specs, see http://www.xmlsoft.org/xmlcatalog_man.html and http://www.oasis-open.org/committees/entity/spec-2001-08-06.html