Class XMPPathParser
java.lang.Object
com.itextpdf.kernel.xmp.impl.xpath.XMPPathParser
Parser for XMP XPaths.
- Since:
- 01.03.2006
-
Method Summary
Modifier and TypeMethodDescriptionstatic XMPPath
expandXPath
(String schemaNS, String path) Split an XMPPath expression apart at the conceptual steps, adding the root namespace prefix to the first property component.
-
Method Details
-
expandXPath
Split an XMPPath expression apart at the conceptual steps, adding the root namespace prefix to the first property component. The schema URI is put in the first (0th) slot in the expanded XMPPath. Check if the top level component is an alias, but don't resolve it.In the most verbose case steps are separated by '/', and each step can be of these forms:
- prefix:name
- A top level property or struct field.
- [index]
- An element of an array.
- [last()]
- The last element of an array.
- [fieldName="value"]
- An element in an array of structs, chosen by a field value.
- [@xml:lang="value"]
- An element in an alt-text array, chosen by the xml:lang qualifier.
- [?qualName="value"]
- An element in an array, chosen by a qualifier value.
- @xml:lang
- An xml:lang qualifier.
- ?qualName
- A general qualifier.
The logic is complicated though by shorthand for arrays, the separating '/' and leading '*' are optional. These are all equivalent: array/*[2] array/[2] array*[2] array[2] All of these are broken into the 2 steps "array" and "[2]".
The value portion in the array selector forms is a string quoted by ''' or '"'. The value may contain any character including a doubled quoting character. The value may be empty.
The syntax isn't checked, but an XML name begins with a letter or '_', and contains letters, digits, '.', '-', '_', and a bunch of special non-ASCII Unicode characters. An XML qualified name is a pair of names separated by a colon.
- Parameters:
-
schemaNS
- schema namespace -
path
- property name - Returns:
- Returns the expandet XMPPath.
- Throws:
-
XMPException
- Thrown if the format is not correct somehow.
-