NetKernel APIs


com.ten60.netkernel.util
Class XMLReadable

java.lang.Object
  extended bycom.ten60.netkernel.util.XMLReadable

public final class XMLReadable
extends Object

Thin wrapper over a DOM to provide fast XPath lookup on values in convenient ways


Constructor Summary
XMLReadable(Node aContextNode)
          Creates a new instance of XMLReadable
 
Method Summary
 int getInt(String aXPath, int aDefault)
          return an integer from text value of the text at a node given by the expression.
 List getNodes(String aXPath)
          return a list of nodes that match the given expression
 String getText(String aXPath)
          return a string value of the text of a single node, returns an empty string if node not found
 List getTexts(String aXPath, boolean aTrim)
          return a list of strings that are the text values of elements matching the given expression
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLReadable

public XMLReadable(Node aContextNode)
Creates a new instance of XMLReadable

Parameters:
aContextNode - the context node that relative expressions are evaluated against
Method Detail

getNodes

public List getNodes(String aXPath)
return a list of nodes that match the given expression


getTexts

public List getTexts(String aXPath,
                     boolean aTrim)
return a list of strings that are the text values of elements matching the given expression

Parameters:
aTrim - if true trims the resulting strings of whitespace

getText

public String getText(String aXPath)
return a string value of the text of a single node, returns an empty string if node not found


getInt

public int getInt(String aXPath,
                  int aDefault)
return an integer from text value of the text at a node given by the expression. if the node isn't found or fails to parse as a number, the default value is used


NetKernel APIs


Copyright © 2002-2004 1060 Research Ltd. All Rights Reserved.