com.codemonster.surinam.parser
Class TreeWalker
java.lang.Object
com.codemonster.surinam.parser.TreeWalker
public class TreeWalker
- extends Object
User: sam
Date: Aug 20, 2007
Time: 10:16:54 AM
TreeWalker
public TreeWalker(Document xmlDoc)
getString
public String getString(XPath path,
String tagname)
throws ElementDoesNotExistException
- Throws:
ElementDoesNotExistException
getLong
public long getLong(XPath path,
String tagname)
throws ElementDoesNotExistException
- Throws:
ElementDoesNotExistException
getFloat
public float getFloat(XPath path,
String tagname)
throws ElementDoesNotExistException
- Throws:
ElementDoesNotExistException
getInt
public int getInt(XPath path,
String tagname)
throws ElementDoesNotExistException
- Throws:
ElementDoesNotExistException
getNode
public XNode getNode(XPath path,
String tagname)
throws ElementDoesNotExistException
- Throws:
ElementDoesNotExistException
getNodeList
public List<XNode> getNodeList(XPath path,
String tagname)
throws ElementDoesNotExistException
- For the given path, finds all the elements matching the given tag name.
- Parameters:
path - This is the path to follow to get to the correct scope to develop the list.tagname - The element name on which the search will be conducted.
- Returns:
- Returns all the elements matching the given tag name.
- Throws:
ElementDoesNotExistException - Thrown if the given tag name doesn't exist.
getRelativeNodeList
public static List<XNode> getRelativeNodeList(XNode rootNode,
XPath path,
String tagName)
throws ElementDoesNotExistException
- Treats the given root node as the root of a sub-tree and follows the given path to the end. Then it
finds all the elements matching the given tag name that are children of that node. If the tagName is given with
the wildcard '*', all children of this node will be returned.
- Parameters:
rootNode - The node, below which, the search for matches will be scoped.path - The relative path from the given root node to the sub-node that will further scope the search.tagName - The element name on which the search will be conducted.
- Returns:
- Returns a list of XNode children of the given node.
- Throws:
ElementDoesNotExistException - Thrown if the given tag name doesn't exist.
Copyright © 2010. All Rights Reserved.