X Path Annotator
The X
is an annotator that can be used to match based on an XPath test expression.
The test will be executed against each XML DOM node. If the test is positive, that particular DOM node will be annotated.
Configuration
test |
The XPath 1.0 expression that will be used to test against each XML DOM node. If the test does not return a Boolean result type, we will apply the |
Yes |
N/A |
Note that the editor is configured with the chunk
and chunk
configuration properties, which sends the document in chunks to Fonto Content Quality.
You will only be able to use an XPath expression within the context of each individual chunk, thus not the complete document.
Using attributes
If you use attributes in your XPath test expression, make sure the editor is rechecking the content if that attribute changes by configuring the semanticAttributes configuration property.
Annotating PI's
If annotating PI's (processing instructions), make sure they have a form of visualization in the document so FCQ is able to highlight that particular node.
You can use the PI annotations in your analysis file without passing them back to the editor. For example, by annotating content enclosed in two PI's by combining this annotator with the AnnotationsRegexAnnotator and then removing the PI annotations (using the RemoveAnnotations filter) afterwards.
Example configuration
In the following example the x
is configured to annotate all <p>
elements which have their class
attribute set to intro
.
XML
<xpathAnnotator annotationTypeId="introduction" test="self::p[@class='intro']" />