Supported XPath expressions

Streams supports data types for SPL attributes using default XPath or XPathList expressions.

The supported data types are:
  • rstring, ustring
  • int8, int16, int32, int64, uint8, uint16, uint32, uint64
  • float32, float64
  • decimal32, decimal64, decimal128
  • tuple
  • list<aboveTypes>
  • list<aboveTypes>[1]

Note that list<aboveTypes>[1] is useful for optional fields.

The supported XPath expressions (xPathExpn) are kept very simple to allow a very fast SAX-based operator implementation. The supported XPath expression formats are:
  • "pathToNode/text()"
  • "pathToNode/@attributeName"`
The valid forms of pathToNode are:
  • . : The current node. You can also use text() or @attributeName for the current node.
  • /absolute/path/expn: For trigger paths only.
  • relative/path/expn: For non-trigger XPath and XPathList paths.
  • pathToNode|pathToNode2: Any of the two (or more) pathToNode values. A pipe (|) is used in a valid XPath expression to select alternates.

XPath predicates are not supported by the XMLParse operator.

The XPath expression for a trigger must be absolute (that is to say, it must start with a forward slash (/)). All other XPath expressions must not start with a forward slash, and are relative to the enclosing XPath expression. The following are valid examples of an XPath expression using the trigger "/foo/bar":


output O : a = XPath ("x/text()"), b = XPath ("c/@cattr");
output O : a = XPath ("a/x", { b = XPath("text()"), 
                               c = XPath("c/@cattr|d/@text") });
                               // /foo/bar/a/x/text() and either
                               // /foo/bar/a/x/c/@cattr or 
                               // /foo/bar/a/x/d/@text()

The following is an invalid example of an XPath expression:


output O : a = XPath ("/fred/text()");