Class XPathParser


  • public class XPathParser
    extends java.lang.Object
    Parser for a very simple XPath subset. Only the following XPath constructs (with namespaces) are supported:
    • .../node()
    • .../text()
    • .../@*
    • .../@name
    • .../*...
    • .../name...
    • ...//*...
    • ...//name...

    In addition the non-abbreviated .../descendant::node() construct can be used for cases where the descendant-or-self axis used by the ...//node() construct is not appropriate.

    • Constructor Summary

      Constructors 
      Constructor Description
      XPathParser()  
      XPathParser​(java.lang.String prefix, java.lang.String namespace)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPrefix​(java.lang.String prefix, java.lang.String namespace)  
      Matcher parse​(java.lang.String xpath)
      Parses the given simple XPath expression to an evaluation state initialized at the document node.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • XPathParser

        public XPathParser()
      • XPathParser

        public XPathParser​(java.lang.String prefix,
                           java.lang.String namespace)
    • Method Detail

      • addPrefix

        public void addPrefix​(java.lang.String prefix,
                              java.lang.String namespace)
      • parse

        public Matcher parse​(java.lang.String xpath)
        Parses the given simple XPath expression to an evaluation state initialized at the document node. Invalid expressions are not flagged as errors, they just result in a failing evaluation state.
        Parameters:
        xpath - simple XPath expression
        Returns:
        XPath evaluation state