public class ElementImpl extends NodeImpl implements Element
Constructor and Description |
---|
ElementImpl()
Create a new instance of ElementImpl.
|
ElementImpl(java.lang.String elemName)
Create a new instance of ElementImpl.
|
ElementImpl(java.lang.String fullName,
java.lang.String namespace)
Creates a new instance of ElementImpl.
|
ElementImpl(java.lang.String fullName,
java.lang.String systemID,
int lineNr)
Creates a new instance of ElementImpl.
|
ElementImpl(java.lang.String fullName,
java.lang.String namespace,
java.lang.String systemID,
int lineNr)
Creates a new instance of ElementImpl.
|
Modifier and Type | Method and Description |
---|---|
void |
addContent(Element childNode)
Add the child node to this node.
|
java.lang.Object |
clone()
Return a deep copy of this node, including copies of all sub-nodes.
|
java.util.List<Attribute> |
getAttributeList()
Get the list of attributes of this element.
|
java.lang.String |
getAttributeValue(java.lang.String attrName)
Get the value of the specified attribute.
|
Element |
getElementChildAtIndex(int index)
Returns the child at a specific index.
|
java.lang.String |
getText()
Get the text value of the element.
|
void |
removeAttribute(java.lang.String attrName)
Remove the attribute with the specified name.
|
void |
setAttribute(java.lang.String attrName,
java.lang.String attrValue)
Add a new attribute and set its value.
|
void |
setText(java.lang.String theText)
Set the text value of the element.
|
addChild, addContent, addContent, detach, getChild, getChildren, getChildrenCount, getValue, hasChildren, removeChild, setValue
addChild, createElement, createElement, createElement, createElement, createPCDataElement, enumerateAttributeNames, enumerateChildren, equals, equalsXMLElement, finalize, getAttribute, getAttribute, getAttribute, getAttribute, getAttribute, getAttributeCount, getAttributeNamespace, getAttributes, getAttributesInNamespace, getAttributeType, getAttributeType, getChildAtIndex, getChildrenNamed, getChildrenNamed, getContent, getFirstChildNamed, getFirstChildNamed, getFullName, getLineNr, getName, getNamespace, getParent, getSystemID, hasAttribute, hasAttribute, insertChild, isLeaf, removeAttribute, removeChild, removeChildAtIndex, setAttribute, setContent, setName, setName
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addChild, addContent, addContent, detach, getChild, getChildren, getChildrenCount, getName, getValue, hasChildren, removeChild, setName, setValue
public ElementImpl()
public ElementImpl(java.lang.String elemName)
elemName
- the element name.public ElementImpl(java.lang.String fullName, java.lang.String namespace)
fullName
- the full name of the elementnamespace
- the namespace symbol.public ElementImpl(java.lang.String fullName, java.lang.String systemID, int lineNr)
fullName
- the full name of the elementsystemID
- the system ID of the XML data where the element starts.lineNr
- the line in the XML data where the element starts.public ElementImpl(java.lang.String fullName, java.lang.String namespace, java.lang.String systemID, int lineNr)
fullName
- the full name of the elementnamespace
- the namespace URI.systemID
- the system ID of the XML data where the element starts.lineNr
- the line in the XML data where the element starts.public void setAttribute(java.lang.String attrName, java.lang.String attrValue)
setAttribute
in interface net.n3.nanoxml.IXMLElement
setAttribute
in interface Element
setAttribute
in class net.n3.nanoxml.XMLElement
attrName
- the name of the attribute.attrValue
- the attribute value.public java.lang.String getAttributeValue(java.lang.String attrName)
getAttributeValue
in interface Element
attrName
- the attribute name.public java.util.List<Attribute> getAttributeList()
getAttributeList
in interface Element
public void removeAttribute(java.lang.String attrName)
removeAttribute
in interface net.n3.nanoxml.IXMLElement
removeAttribute
in interface Element
removeAttribute
in class net.n3.nanoxml.XMLElement
attrName
- the attribute name.public void setText(java.lang.String theText)
public java.lang.String getText()
public Element getElementChildAtIndex(int index) throws java.lang.Exception
getElementChildAtIndex
in interface Element
index
- the index of the childjava.lang.Exception
- any error.public void addContent(Element childNode)
addContent
in interface Element
childNode
- the node to add as a child node.