Class XMPPathParser


public final class XMPPathParser extends Object
Parser for XMP XPaths.
  • Method Details

    • expandXPath

      public static XMPPath expandXPath (String schemaNS, String path) throws XMPException
      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:

      A top level property or struct field.
      An element of an array.
      The last element of an array.
      An element in an array of structs, chosen by a field value.
      An element in an alt-text array, chosen by the xml:lang qualifier.
      An element in an array, chosen by a qualifier value.
      An xml:lang qualifier.
      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.

      schemaNS - schema namespace
      path - property name
      Returns the expandet XMPPath.
      XMPException - Thrown if the format is not correct somehow.