@OpenApiAll public class ElementNode extends java.lang.Object implements Node, java.io.Serializable
Constructor and Description |
---|
ElementNode(java.lang.String name)
Create an element with out associated attribute.
|
ElementNode(java.lang.String name,
org.xml.sax.Attributes attributes)
Create an element with associated attributes.
|
Modifier and Type | Method and Description |
---|---|
void |
appendChild(Node e)
Adds the node newChild to the end of the list of children of this node.
|
void |
appendContent(char[] str,
int offset,
int len)
Append a content.
|
java.lang.Object |
getACustomProperty(java.lang.String key) |
java.lang.String |
getAttribute(java.lang.String qName)
Retrieves an attribute value by name.
|
org.xml.sax.Attributes |
getAttributes()
Retrieves XML attributes.
|
java.util.Collection<Node> |
getChildNodes()
Return a child.
|
java.lang.StringBuffer |
getContent()
Return a content.
|
java.util.Map<java.lang.String,java.lang.Object> |
getCustomProperty() |
java.lang.String |
getEndText()
Return an end text.
|
Node |
getFirstChild()
The first child of this node.
|
Node |
getLastChild()
The last child of this node.
|
java.lang.String |
getName()
Return a name.
|
Node |
getParentNode()
Return the parent of this node.
|
java.lang.String |
getStartText()
Return a start text.
|
boolean |
hasTextContent(java.util.Collection<Node> childNodes)
Return true when
childNodes contains at least one text node. |
void |
insertBefore(Node newChild,
int index)
Inserts the node newChild before the child index.
|
Node |
removeChild(Node oldChild)
Removes the child node indicated by oldChild from the list of children, and returns it.
|
void |
setACustomProperty(java.lang.String key,
java.lang.Object obj) |
void |
setAttribute(java.lang.String attrName,
java.lang.String attrValue)
Adds a new attribute.
|
void |
setAttribute(java.lang.String uri,
java.lang.String localName,
java.lang.String qName,
java.lang.String type,
java.lang.String value)
Adds a new attribute.
|
void |
setCustomProperty(java.util.Map<java.lang.String,java.lang.Object> customProperty) |
void |
setParentNode(Node e)
Set a parent of this node.
|
java.lang.String |
toString()
Return string represents this object.
|
public ElementNode(java.lang.String name)
name
- an element name.public ElementNode(java.lang.String name, org.xml.sax.Attributes attributes)
name
- an element nameattributes
- attributespublic java.lang.StringBuffer getContent()
public boolean hasTextContent(java.util.Collection<Node> childNodes)
childNodes
contains at least one text node.childNodes
- collection of child nodechildNodes
contains at least one text node; otherwise false.public void appendContent(char[] str, int offset, int len)
str
- the characters to be appended.offset
- the index of the first char to append.len
- the number of chars to append.public java.lang.String getName()
public java.lang.String getStartText()
public java.lang.String getEndText()
public void setAttribute(java.lang.String uri, java.lang.String localName, java.lang.String qName, java.lang.String type, java.lang.String value)
uri
- The Namespace URI, or the empty string if none is available or Namespace processing is not being
performed.localName
- The local name, or the empty string if Namespace processing is not being performed.qName
- The qualified (prefixed) name, or the empty string if qualified names are not available.type
- The attribute type as a string.value
- The attribute value.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public java.lang.String getAttribute(java.lang.String qName)
qName
- The name of the attribute to retrieve.public org.xml.sax.Attributes getAttributes()
public void setAttribute(java.lang.String attrName, java.lang.String attrValue) throws org.w3c.dom.DOMException
attrName
- The name of the attribute to create or alter.attrValue
- Value to set in string form.org.w3c.dom.DOMException
- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.public java.lang.String toString()
toString
in class java.lang.Object
public void appendChild(Node e)
appendChild
in interface Node
e
- a child elementpublic Node removeChild(Node oldChild)
removeChild
in interface Node
oldChild
- The node being removed.public void insertBefore(Node newChild, int index)
insertBefore
in interface Node
newChild
- the node to insertindex
- the reference child indexpublic java.util.Collection<Node> getChildNodes()
getChildNodes
in interface Node
public Node getLastChild()
public Node getFirstChild()
public Node getParentNode()
getParentNode
in interface Node
public void setParentNode(Node e)
setParentNode
in interface Node
e
- a node.public java.util.Map<java.lang.String,java.lang.Object> getCustomProperty()
public void setCustomProperty(java.util.Map<java.lang.String,java.lang.Object> customProperty)
public java.lang.Object getACustomProperty(java.lang.String key)
public void setACustomProperty(java.lang.String key, java.lang.Object obj)
Copyright © 2010 - No Magic Asia