public class EasyNode
extends Object
Modifier and Type | Field and Description |
---|---|
private ArrayList<String> |
attrNames
Attribute names for this node
|
private ArrayList<String> |
attrValues
Attribute values for this node
|
private ArrayList<EasyNode> |
children
Child elements for this node
|
private static Configuration |
config
Configuration used for parsing XML files
|
private NodeInfo |
wrapped
The node we are wrapping
|
Constructor and Description |
---|
EasyNode(NodeInfo toWrap)
Wrap a NodeInfo
|
Modifier and Type | Method and Description |
---|---|
String |
attrName(int index)
Get a specific numbered attribute's name
|
List<String> |
attrNames()
Get a list of all attribute names
|
String |
attrValue(int index)
Get a specific numbered attribute's value
|
String |
attrValue(String name)
Get a named attribute's value, or null if no such name found.
|
EasyNode |
child(int index)
Get a specific numbered child of this node
|
EasyNode |
child(String name)
Get the first child node with the specified name, case insensitive.
|
List<EasyNode> |
children()
Get all the children
|
private void |
getAttrs()
Iterate the attributes and fill the 'attrNames' and 'attrValues' vectors.
|
private void |
getChildren()
Iterate the children and fill the 'children' vector.
|
NodeInfo |
getWrappedNode()
Get the actual node we're wrapping
|
boolean |
hasAttr(String name)
Check if this node has the given attribute
|
boolean |
isElement()
Checks if this is an element node
|
boolean |
isText()
Checks if this is a text node
|
String |
name()
Get the name of this node
|
int |
nAttrs()
Get the number of attributes this node has
|
int |
nChildren()
Get a count of the number of children this node has
|
EasyNode |
parent()
Get the parent of this node (if any)
|
static EasyNode |
readXMLFile(File path)
Convenience method to read an XML file and return the root node.
|
static EasyNode |
readXMLFile(String path)
Convenience method to read an XML file and return the root node.
|
String |
toString()
Get the string value of this node
|
private NodeInfo wrapped
private ArrayList<String> attrNames
private ArrayList<String> attrValues
private ArrayList<EasyNode> children
private static Configuration config
public static EasyNode readXMLFile(String path)
public static EasyNode readXMLFile(File path)
private void getAttrs()
private void getChildren()
public int nAttrs()
public String attrName(int index)
public List<String> attrNames()
public String attrValue(int index)
public boolean hasAttr(String name)
public String attrValue(String name)
public int nChildren()
public EasyNode child(int index)
public EasyNode child(String name)
public List<EasyNode> children()
public EasyNode parent()
public String name()
public boolean isElement()
public boolean isText()
public String toString()
toString
in class Object
public NodeInfo getWrappedNode()