public class EasyElement
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
absPath |
protected java.util.TreeMap<java.lang.String,java.lang.String> |
attributes |
static java.lang.String |
BLANK |
protected java.util.HashMap<java.lang.String,java.util.ArrayList<EasyElement>> |
childMap |
protected java.util.ArrayList<EasyElement> |
children |
static boolean |
COPYCHILDREN |
protected java.util.ArrayList<java.lang.String> |
exceptions |
protected java.lang.String |
name |
static boolean |
NOCHILDREN |
protected EasyElement |
parent |
protected java.lang.String |
text |
protected boolean |
textToChild |
Constructor and Description |
---|
EasyElement() |
Modifier and Type | Method and Description |
---|---|
void |
addChild(EasyElement child) |
void |
addChild(java.lang.String key,
java.lang.String value)
A convenience method for adding a child without invoking the EasyElement constructor.
|
EasyElement |
buildFromElement(org.w3c.dom.Element element)
Make an EasyElement that represents org.w3c.dom.Element element.
|
EasyElement |
buildFromPath(java.lang.String inputPath)
Make an EasyElement representing the root element and its decendants contained in the xml document at path inputPath.
|
EasyElement |
copy(boolean copychildren)
Makes a copy of this EasyElement, with or without children.
|
java.lang.String |
getAbsPath()
If the calling routine populated this EasyElement with method EasyElement.buildFromPath(String inputPath), this method returns the absolute path of inputPath.
|
java.util.TreeMap<java.lang.String,java.lang.String> |
getAttributes() |
EasyElement |
getCacheable()
Returns true if this has an attribute anywhere in its tree that matches handle->value.
|
protected EasyElement |
getCacheable(EasyElement iee)
Returns a copy of EasyElement iee nested within EasyElements that correspond to iee's antecedents.
|
java.util.ArrayList<EasyElement> |
getChildren() |
java.util.ArrayList<EasyElement> |
getChildrenByName(java.lang.String childName)
Returns all children with the name childName.
|
java.util.ArrayList<EasyElement> |
getEasyElementsByAttribute(java.lang.String attname)
Return all EasyElements in the tree (this and all descendants of this) that have an attribute with the name attname.
|
java.util.ArrayList<EasyElement> |
getEasyElementsByName(java.lang.String ename)
Return all EasyElements in the tree (this and all descendants of this) that have the name ename.
|
java.util.ArrayList<java.lang.String> |
getExceptions() |
EasyElement |
getFirst(java.lang.String childName)
A convenience class helpful when the calling routine knows that an EasyElement has only one child with the name childName.
|
java.lang.String |
getName()
The tag name.
|
EasyElement |
getParent() |
java.lang.String |
getText()
Text value of the EasyElement.
|
EasyElement |
getXPathsForAttribute(java.lang.String handle,
java.lang.String value)
Returns a stripped down EasyElement that represents all XPaths to elements that have attributes that match handle->value.
|
EasyElement |
getXPathsForName(java.lang.String tgname)
Returns a stripped down EasyElement that represents all XPaths to elements that match name tgname.
|
boolean |
hasAttributePair(java.lang.String handle,
java.lang.String value)
Returns true if this has an attribute anywhere in its tree that matches handle->value.
|
boolean |
hasChild(java.lang.String childName)
True if EasyElement has a child with the name childName.
|
boolean |
hasParent()
True if this EasyElement has a parent EasyElement.
|
void |
populate(org.w3c.dom.Element element)
This method is called from within the EasyElement class.
|
void |
setAttribute(java.lang.String key,
java.lang.String value)
Add an xml attribute key value pair to the EasyElement.
|
EasyElement |
setName(java.lang.String aname)
Set the tag name for this EasyElement.
|
void |
setParent(EasyElement ee) |
EasyElement |
setText(java.lang.String atext)
Set the text value for this EasyElement.
|
void |
textToChild(java.lang.String childname)
Convert text node represented by variable text into child EasyElement childname->text
if calling routine calls this method, getText() for EasyElement this will return a blank string.
|
protected java.util.ArrayList<java.lang.String> exceptions
protected java.util.ArrayList<EasyElement> children
protected java.util.HashMap<java.lang.String,java.util.ArrayList<EasyElement>> childMap
protected java.util.TreeMap<java.lang.String,java.lang.String> attributes
protected java.lang.String name
protected java.lang.String text
protected java.lang.String absPath
protected EasyElement parent
protected boolean textToChild
public static final java.lang.String BLANK
public static final boolean COPYCHILDREN
public static final boolean NOCHILDREN
public EasyElement buildFromPath(java.lang.String inputPath)
public EasyElement buildFromElement(org.w3c.dom.Element element)
public EasyElement setName(java.lang.String aname)
public EasyElement setText(java.lang.String atext)
public java.util.ArrayList<EasyElement> getEasyElementsByName(java.lang.String ename)
public EasyElement getCacheable()
protected EasyElement getCacheable(EasyElement iee)
public boolean hasParent()
public void textToChild(java.lang.String childname)
public boolean hasAttributePair(java.lang.String handle, java.lang.String value)
public EasyElement getXPathsForName(java.lang.String tgname)
public EasyElement getXPathsForAttribute(java.lang.String handle, java.lang.String value)
public EasyElement copy(boolean copychildren)
public java.util.ArrayList<EasyElement> getEasyElementsByAttribute(java.lang.String attname)
public void populate(org.w3c.dom.Element element)
public java.lang.String getName()
public java.lang.String getText()
public java.util.TreeMap<java.lang.String,java.lang.String> getAttributes()
public java.util.ArrayList<EasyElement> getChildren()
public boolean hasChild(java.lang.String childName)
public EasyElement getFirst(java.lang.String childName)
public java.util.ArrayList<EasyElement> getChildrenByName(java.lang.String childName)
public void setParent(EasyElement ee)
public EasyElement getParent()
public void addChild(java.lang.String key, java.lang.String value)
public void addChild(EasyElement child)
public void setAttribute(java.lang.String key, java.lang.String value)
public java.util.ArrayList<java.lang.String> getExceptions()
public java.lang.String getAbsPath()