To avoid building large XML DOM trees in memory, XMLProbe provides an alternative handler, com.xmlprobe.MultiRootQAHandler.
This technique is particularly suited to multi-megabyte XML documents which can be seen as containing many smaller, record-like instances.
To use, declare MultiRootQAHandler as an add-in, removing any add-in references to com.xmlprobe.QAHandler. The feature http://xmlprobe.com/features/pseudo-root-element must also be declared. The probe:value element of this feature should contain the name of the element by which the instance will be "fragmented" into smaller documents (the "pseudo-root" element):
...
<probe:addIn>
<probe:name>com.xmlprobe.MultiRootQAHandler</probe:name>
<probe:config>
<probe:feature>
<probe:name>http://xmlprobe.com/features/use-xpath-locators</probe:name>
<probe:value>true</probe:value>
</probe:feature>
<probe:feature>
<probe:name>http://xmlprobe.com/features/pseudo-root-element</probe:name>
<probe:value>record</probe:value>
</probe:feature>
</probe:config>
</probe:addIn>
...
In this case, each instance of the element record (in bold above) in the document will cause a new document to be constructed. If a document rooted on this element is already being built, an occurrence of the same element is simply nested within the new document.
Each XPath expression in the ruleset is evaluated in the normal way, with the document root ('/') of the document fragment as the context. Any matching nodes are reported using relative, rather than absolute XPath locators (contained in silcn:expression): e.g. //record[235]/foo.
When writing QA rules for use with MultiRootQAHandler, remember that the evaluation context is the root of the document as fragmented according to pseudo-root element name. Avoid XPath expressions whose scope refers to the unfragmented document as a whole, since these will only be evaluated in the context of the document root of each fragment.