com.jayway.restassured.path.xml.element
Interface PathElement

All Superinterfaces:
Iterable<String>
All Known Subinterfaces:
Node, NodeChildren
All Known Implementing Classes:
NodeChildrenImpl, NodeImpl

public interface PathElement
extends Iterable<String>

Base object for all XML objects.


Method Summary
<T> T
get(String name)
          Get a value from the current XML object.
 Node getNode(String name)
          Get a Node whose name matches the supplied name from the current XML object.
 List<Node> getNodes(String name)
          Get a list of Node's whose name matches the supplied name from the current XML object.
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

get

<T> T get(String name)
Get a value from the current XML object.

This method returns the child whose name matches name. If several children matches the name then a List of Node's are returned.

If this object is a Node and you want to return an attribute value you need to prefix the name with an @. E.g. given

   <category type="present">
      <item when="Aug 10">
         <name>Kathryn's Birthday</name>
         <price>200</price>
      </item>
   </category>
 
then
  String type = node.get("@type");
 
will return "present".

Type Parameters:
T - The expected type of the return value.
Parameters:
name - The name of the child, children or attribute.
Returns:
A Node, a list of nodes, an attribute value or null if not found.

getNode

Node getNode(String name)
Get a Node whose name matches the supplied name from the current XML object.

Note that there's no guarantee that this method actually will return a Node. It could result in a .

Parameters:
name - The name of the Node to get.
Returns:
The Node matching the name or null if non were found.

getNodes

List<Node> getNodes(String name)
Get a list of Node's whose name matches the supplied name from the current XML object.

Parameters:
name - The name of the Nodes to get.
Returns:
The Node matching the name or an empty list of non were found.


Copyright © 2010-2011. All Rights Reserved.