com.pdfunit.xml

## Class XPathExpression

- java.lang.Object
- - com.pdfunit.xml.XPathExpression

-     @DoNotObfuscate
      public class XPathExpression
      extends java.lang.Object

  This class wraps an instance of javax.xml.xpath.XPathExpression. Namespaces for a later XPath processing can be added by a separate function.
  Since:
    2016.05
  Author:
    Carsten Siedentop, March 2016

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `XPathExpression(java.lang.String xpath)` Create an instance of an XPath expression.
    `XPathExpression(java.lang.String xpath, DefaultNamespace defaultNS)` Create an instance of an XPath expression.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addNamespaces(java.util.Hashtable<java.lang.String,java.lang.String> newNamespaces)`
    `java.lang.Object` | `evaluate(org.w3c.dom.Document dom, javax.xml.namespace.QName qName)` Evaluate the current XPath expression against the DOM, given by the first parameter.
    `java.lang.String` | `getExpression()` This method does what the name suggests.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### XPathExpression

          @Guarded
          public XPathExpression(java.lang.String xpath)

      Create an instance of an XPath expression.

    - #### XPathExpression

          @Guarded
          public XPathExpression(java.lang.String xpath,
                                 DefaultNamespace defaultNS)

      Create an instance of an XPath expression. For the later processing, the default namespace is taken as the second parameter.

      The constructor is synchronized because it's not clear, whether the used XPath processors is thread-safe.

  - ### Method Detail

    - #### getExpression

          public java.lang.String getExpression()

      This method does what the name suggests.

    - #### evaluate

          public java.lang.Object evaluate(org.w3c.dom.Document dom,
                                  javax.xml.namespace.QName qName)

      Evaluate the current XPath expression against the DOM, given by the first parameter. The second parameter defines the intended result type.

    - #### addNamespaces

          public void addNamespaces(java.util.Hashtable<java.lang.String,java.lang.String> newNamespaces)

Copyright (C) PDFUnit.com. See here for license.