dk.brics.xact.operations
Class XMLNavigator

java.lang.Object
  extended by dk.brics.xact.operations.XMLNavigator

public class XMLNavigator
extends Object

XPath evaluator for XML templates.

Traversal uses mutable node wrappers (see NodeWrapper) such that the DAG gets expanded to a tree by need. Visited nodes are copied, so all selected nodes are guaranteed to be fresh objects.


Nested Class Summary
static class XMLNavigator.ElementListResult
          Element list result.
static class XMLNavigator.NodeListResult
          Node list result.
static class XMLNavigator.NodeResult
          Single-node result.
static class XMLNavigator.Result
          Abstract result of evaluation.
 
Method Summary
static boolean booleanValueOf(XML context, String xpath)
          Returns the boolean value of the first selected node.
static boolean isValidXPathString(String s)
          Returns false if the given string contains a quotation mark ('single' or "double").
static Number numberValueOf(XML context, String xpath)
          Returns the number value of the first selected node.
static Element selectElementByID(XML context, String id, boolean remove_successors)
          Returns the element node by the given ID.
static XMLNavigator.ElementListResult selectElements(XML context, String xpath, boolean remove_successors)
          Returns the selected sequence of element nodes (ignoring other nodes).
static XMLNavigator.NodeListResult selectNodes(XML context, String xpath, boolean remove_successors)
          Returns the selected nodes.
static XMLNavigator.NodeResult selectSingleNode(XML context, String xpath, boolean remove_successors)
          Returns the first selected node.
static List<String> selectStrings(XML context, String xpath)
          Returns the string values of the selected nodes.
static String stringValueOf(XML context, String xpath)
          Returns the string value of the first selected node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

booleanValueOf

public static boolean booleanValueOf(XML context,
                                     String xpath)
Returns the boolean value of the first selected node.


isValidXPathString

public static boolean isValidXPathString(String s)
Returns false if the given string contains a quotation mark ('single' or "double").


numberValueOf

public static Number numberValueOf(XML context,
                                   String xpath)
Returns the number value of the first selected node.


selectElementByID

public static Element selectElementByID(XML context,
                                        String id,
                                        boolean remove_successors)
Returns the element node by the given ID.


selectElements

public static XMLNavigator.ElementListResult selectElements(XML context,
                                                            String xpath,
                                                            boolean remove_successors)
Returns the selected sequence of element nodes (ignoring other nodes).


selectNodes

public static XMLNavigator.NodeListResult selectNodes(XML context,
                                                      String xpath,
                                                      boolean remove_successors)
Returns the selected nodes.


selectSingleNode

public static XMLNavigator.NodeResult selectSingleNode(XML context,
                                                       String xpath,
                                                       boolean remove_successors)
Returns the first selected node.


selectStrings

public static List<String> selectStrings(XML context,
                                         String xpath)
Returns the string values of the selected nodes.


stringValueOf

public static String stringValueOf(XML context,
                                   String xpath)
Returns the string value of the first selected node.



Copyright © 2005-2011 Aarhus University.