org.jopendocument.util
Class SimpleXMLPath<T>

java.lang.Object
  extended by org.jopendocument.util.SimpleXMLPath<T>
Type Parameters:
T - type of result.

public final class SimpleXMLPath<T>
extends java.lang.Object

Like an XPath with less features but a greater speed. Thread-safe if its steps are.

Author:
Sylvain CUAZ

Method Summary
static SimpleXMLPath<org.jdom.Attribute> allAttributes(java.lang.String name, java.lang.String ns)
          Create a path searching for all descendant attributes with the passed name and namespace.
static SimpleXMLPath<org.jdom.Element> allElements(java.lang.String name, java.lang.String ns)
          Create a path searching for all descendant elements with the passed name and namespace.
static
<T> SimpleXMLPath<T>
create(java.util.List<Step<?>> steps, Step<T> lastStep)
           
static
<T> SimpleXMLPath<T>
create(Step<?> first, Step<?> second, Step<T> lastStep)
           
static
<T> SimpleXMLPath<T>
create(Step<?> first, Step<T> lastStep)
           
static
<T> SimpleXMLPath<T>
create(Step<T> lastStep)
           
 java.util.List<T> selectNodes(java.util.List<?> nodes)
           
 java.util.List<T> selectNodes(java.lang.Object n)
           
 T selectSingleNode(java.lang.Object n)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

create

public static <T> SimpleXMLPath<T> create(java.util.List<Step<?>> steps,
                                          Step<T> lastStep)

create

public static <T> SimpleXMLPath<T> create(Step<T> lastStep)

create

public static <T> SimpleXMLPath<T> create(Step<?> first,
                                          Step<T> lastStep)

create

public static <T> SimpleXMLPath<T> create(Step<?> first,
                                          Step<?> second,
                                          Step<T> lastStep)

allAttributes

public static SimpleXMLPath<org.jdom.Attribute> allAttributes(java.lang.String name,
                                                              java.lang.String ns)
Create a path searching for all descendant attributes with the passed name and namespace. I.e. in XPath this would be ".//@ns:name".

Parameters:
name - the name of attributes.
ns - the namespace of attributes.
Returns:
a path searching attributes in all Step.Axis.descendantOrSelf elements.

allElements

public static SimpleXMLPath<org.jdom.Element> allElements(java.lang.String name,
                                                          java.lang.String ns)
Create a path searching for all descendant elements with the passed name and namespace. I.e. in XPath this would be ".//ns:name".

Parameters:
name - the name of elements.
ns - the namespace of elements.
Returns:
a path searching all Step.Axis.descendantOrSelf elements.

selectSingleNode

public final T selectSingleNode(java.lang.Object n)

selectNodes

public final java.util.List<T> selectNodes(java.lang.Object n)

selectNodes

public final java.util.List<T> selectNodes(java.util.List<?> nodes)