How can I batch process XML files?

The batch processing functionality formerly supported by XMLProbe is now provided by the product's Content Control Server edition.

For desktop installations, we strongly recommend extracting the contents of archives (e.g. ZIP files) before using XMLProbe to process them.

It is possible to write rules to be evaluated against a set of documents, including cross-checks between documents in that set, using XPath. For this example, it is assumed that a manifest of file URLs exists:

<!--manifest.xml-->

<files>
  <file>a.xml</file>
  <file>b.xml</file>
  <file>c.xml</file>
  <!--etc.-->
</files>

When manifest.xml is accessed by XMLProbe, the URLs it contains can all be opened by the document() function, just as in XSLT 1.0. Here, a variable containing the nodeset of all the documents whose URLs are specified in manifest.xml is declared for convenience:

<probe:variable>
  <probe:name>all-documents</probe:name>
  <probe:eval>document( document( 'manifest.xml' )/files/file )</probe:eval>
</probe:variable>

In this expression, the inner call to document() returns a node-set of URLs (from the file elements selected), while the outer call accesses each URL, returning a node-set consisting of all the documents.

To perform a check across the set of documents, for instance to see whether all issn elements have the same value, this expression can be used, making use of the variable declared above:

<silcn:expression>/path/to/issn[ . != $all-documents//issn ]</silcn:expression>

which reports any issn elements whose string content differs from that selected in the current document.