|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object org.attoparser.markup.dom.Node org.attoparser.markup.dom.Element
public final class Element
Base abstract class for all nodes in a attoDOM tree which have children.
Constructor Summary | |
---|---|
Element(String name,
boolean standalone)
|
|
Element(String name,
boolean standalone,
int line,
int col)
|
Method Summary | |
---|---|
void |
addAttribute(String attributeName,
String attributeValue)
|
void |
addAttributes(Map<String,String> newAttributes)
|
void |
addChild(Node newChild)
|
void |
clearAttributes()
|
void |
clearChildren()
Clears all children from this node. |
Map<String,String> |
getAttributeMap()
Returns a map with all the names and values of the element attributes. |
String |
getAttributeValue(String attributeName)
Returns the value of an attribute from its attribute name. |
String |
getAttributeValueIgnoreCase(String attributeName)
Returns the value of an attribute from its attribute name, ignoring case in attribute name. |
List<Node> |
getChildren()
Returns the children of this node. |
List<Element> |
getElementChildren()
Returns only the Element children
of this node, discarding children of any other types. |
Node |
getFirstChild()
Returns the first child of this node. |
Element |
getFirstElementChild()
Returns the first child of type Element . |
String |
getName()
|
boolean |
hasAttribute(String attributeName)
Returns whether an attribute exists in the element or not. |
boolean |
hasAttributeIgnoreCase(String attributeName)
Returns whether an attribute exists in the element or not, ignoring case differences. |
boolean |
hasAttributes()
Returns whether this element has any attributes or not. |
boolean |
hasChildren()
Returns whether this node has any children. |
void |
insertChild(int index,
Node newChild)
|
void |
insertChildAfter(Node after,
Node newChild)
|
void |
insertChildBefore(Node before,
Node newChild)
|
boolean |
isStandalone()
|
int |
numAttributes()
Returns the number of attributes contained in this element. |
int |
numChildren()
Returns the number of children in this node. |
void |
removeAttribute(String attributeName)
|
void |
removeAttributeIgnoreCase(String attributeName)
|
void |
removeChild(Node child)
|
void |
setName(String name)
|
void |
setStandalone(boolean standalone)
|
void |
visit(AttoDOMVisitor visitor)
|
Methods inherited from class org.attoparser.markup.dom.Node |
---|
getCol, getLine, getParent, hasParent |
Methods inherited from class Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Element(String name, boolean standalone, int line, int col)
public Element(String name, boolean standalone)
Method Detail |
---|
public String getName()
public void setName(String name)
public boolean isStandalone()
public void setStandalone(boolean standalone)
public final boolean hasChildren()
Returns whether this node has any children.
public final int numChildren()
Returns the number of children in this node.
public final List<Node> getChildren()
Returns the children of this node. The returned list is immutable.
public final void clearChildren()
Clears all children from this node.
public final List<Element> getElementChildren()
Returns only the Element
children
of this node, discarding children of any other types.
The returned list is immutable.
public final Node getFirstChild()
Returns the first child of this node.
public final Element getFirstElementChild()
Returns the first child of type Element
.
public void addChild(Node newChild)
public void insertChild(int index, Node newChild)
public void insertChildBefore(Node before, Node newChild)
public void insertChildAfter(Node after, Node newChild)
public void removeChild(Node child)
public boolean hasAttributes()
Returns whether this element has any attributes or not.
public int numAttributes()
Returns the number of attributes contained in this element.
public boolean hasAttribute(String attributeName)
Returns whether an attribute exists in the element or not.
attributeName
- the name of the attribute to be checked.
public boolean hasAttributeIgnoreCase(String attributeName)
Returns whether an attribute exists in the element or not, ignoring case differences.
attributeName
- the name of the attribute to be checked.
public String getAttributeValue(String attributeName)
Returns the value of an attribute from its attribute name.
attributeName
- the attribute name.
public String getAttributeValueIgnoreCase(String attributeName)
Returns the value of an attribute from its attribute name, ignoring case in attribute name.
attributeName
- the attribute name.
public Map<String,String> getAttributeMap()
Returns a map with all the names and values of the element attributes.
The map object returned by this method is immutable.
public void addAttribute(String attributeName, String attributeValue)
public void addAttributes(Map<String,String> newAttributes)
public void clearAttributes()
public void removeAttribute(String attributeName)
public void removeAttributeIgnoreCase(String attributeName)
public final void visit(AttoDOMVisitor visitor) throws AttoDOMVisitorException
visit
in class Node
AttoDOMVisitorException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |