Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.util.xml
Class XPathUtils

    java.lang.Object
      org.apache.muse.util.xml.XPathUtils

public class XPathUtils
extends java.lang.Object

XPathUtils is a collection of utility methods related to XPath 1.0. It depends on Apache Xalan.

Author:
  Dan Jemiolo (danj)

Field Summary
`static java.lang.String` | `NAMESPACE_URI` The XPath 1.0 namespace URI.

Constructor Summary
`XPathUtils()`

Method Summary
`static boolean` | `isMatch(org.w3c.dom.Node context, java.lang.String xpath)` Evaluates the given XPath as a Boolean expression against the given XML.
`static org.w3c.dom.Node[]` | `select(org.w3c.dom.Node context, java.lang.String xpath)` Returns the first Node that matches the given XPath expression.
`static org.w3c.dom.Node[]` | `selectNodeList(org.w3c.dom.Node context, java.lang.String xpath)` Returns a set of all Nodes that match the given XPath expression.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NAMESPACE_URI

    public static final java.lang.String NAMESPACE_URI

  The XPath 1.0 namespace URI.

  See Also:
    Constant Field Values

Constructor Detail

### XPathUtils

    public XPathUtils()

Method Detail

### isMatch

    public static boolean isMatch(org.w3c.dom.Node context,
                                  java.lang.String xpath)
                           throws javax.xml.transform.TransformerException

  Evaluates the given XPath as a Boolean expression against the given XML.

  Parameters:
    `context` - The node from which to start all XPath evaluations. This node becomes irrelevant if the expression is an absolute path.
    `xpath` - The XPath expression to evaluate.
  Returns:
    True if the XPath evaluates to "true" or a collection of Nodes.
  Throws:
    `javax.xml.transform.TransformerException` -
    - If the XPath expression is invalid.

### select

    public static org.w3c.dom.Node[] select(org.w3c.dom.Node context,
                                            java.lang.String xpath)
                                     throws javax.xml.transform.TransformerException

  Returns the first Node that matches the given XPath expression. The expression is evaluated in the context of the first parameter.

  Parameters:
    `context` - The node from which to start all XPath evaluations. This node becomes irrelevant if the expression is an absolute path.
    `xpath` - The XPath expression to evaluate.
  Returns:
    The set of Nodes that match the expression. If there are no matches, the method returns null. If the expression evaluates to a Boolean, string, or number, the Node is a DOM Text with the appropriate value.
  Throws:
    `javax.xml.transform.TransformerException` -
    - If the XPath expression is invalid.

### selectNodeList

    public static org.w3c.dom.Node[] selectNodeList(org.w3c.dom.Node context,
                                                    java.lang.String xpath)
                                             throws javax.xml.transform.TransformerException

  Returns a set of all Nodes that match the given XPath expression. The expression is evaluated in the context of the first parameter.

  Parameters:
    `context` - The node from which to start all XPath evaluations. This node becomes irrelevant if the expression is an absolute path.
    `xpath` - The XPath expression to evaluate.
  Returns:
    The set of Nodes that match the expression. If there are no matches, the method returns null.
  Throws:
    `javax.xml.transform.TransformerException` -
    - If the XPath expression is invalid.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD