Class XPath<R>

java.lang.Object
com.metreeca.xml.actions.XPath<R>
Type Parameters:
R - the type of the value returned by the processing action
All Implemented Interfaces:
Function<Node,R>

public final class XPath<R> extends Object implements Function<Node,R>
XPath-based XML node processing.

Maps XML nodes to values produced by a function taking as argument a node-targeted XPath processor.

  • Field Details

    • DefaultPrefix

      public static final String DefaultPrefix
      The prefix mapped to the default namespace of the target document ("_").
      See Also:
  • Constructor Details

    • XPath

      public XPath(Function<XPath.Processor,R> query)
      Creates an XPath-based node processing action.
      Parameters:
      query - a function taking as argument a processor and returning a value
      Throws:
      NullPointerException - if query is null
  • Method Details

    • decode

      public static String decode(CharSequence text)
      Decodes XML numeric entities.
      Parameters:
      text - the text to be decoded
      Returns:
      a version of text where XML numeric entities (for instance &#x2019; or &#8220;) are replaced with the corresponding Unicode characters
      Throws:
      NullPointerException - if text is null
    • apply

      public R apply(Node node)
      Specified by:
      apply in interface Function<Node,R>