Class ElementNode
java.lang.Object
com.nomagic.magicreport.engine.xml.ElementNode
- All Implemented Interfaces:
Node,Serializable
The Element represents an element in XML document.
- Since:
- Jun 1, 2009
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionElementNode(String name) Create an element with out associated attribute.ElementNode(String name, Attributes attributes) Create an element with associated attributes. -
Method Summary
Modifier and TypeMethodDescriptionvoidappendChild(Node e) Adds the node newChild to the end of the list of children of this node.voidappendContent(char[] str, int offset, int len) Append a content.getACustomProperty(String key) getAttribute(String qName) Retrieves an attribute value by name.Retrieves XML attributes.Return a child.Return a content.Return an end text.The first child of this node.The last child of this node.getName()Return a name.Return the parent of this node.Return a start text.booleanhasTextContent(Collection<Node> childNodes) Return true whenchildNodescontains at least one text node.voidinsertBefore(Node newChild, int index) Inserts the node newChild before the child index.removeChild(Node oldChild) Removes the child node indicated by oldChild from the list of children, and returns it.voidsetACustomProperty(String key, Object obj) voidsetAttribute(String attrName, String attrValue) Adds a new attribute.voidAdds a new attribute.voidsetCustomProperty(Map<String, Object> customProperty) voidSet a parent of this node.toString()Return string represents this object.
-
Constructor Details
-
ElementNode
Create an element with out associated attribute.- Parameters:
name- an element name.
-
ElementNode
Create an element with associated attributes.- Parameters:
name- an element nameattributes- attributes
-
-
Method Details
-
getContent
Return a content.- Returns:
- the content
-
hasTextContent
Return true whenchildNodescontains at least one text node.- Parameters:
childNodes- collection of child node- Returns:
- true when
childNodescontains at least one text node; otherwise false.
-
appendContent
public void appendContent(char[] str, int offset, int len) Append a content.- Parameters:
str- the characters to be appended.offset- the index of the first char to append.len- the number of chars to append.
-
getName
Return a name.- Returns:
- the name
-
getStartText
Return a start text.- Returns:
- the startText
-
getEndText
Return an end text.- Returns:
- the endText
-
setAttribute
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.- Parameters:
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.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
getAttribute
Retrieves an attribute value by name.- Parameters:
qName- The name of the attribute to retrieve.- Returns:
- The attribute value as a string, or the empty string.
-
getAttributes
Retrieves XML attributes.- Returns:
- The XML attributes.
-
setAttribute
Adds a new attribute. If an attribute with that name is already present in the element, its value is changed to be that of the value parameter.- Parameters:
attrName- The name of the attribute to create or alter.attrValue- Value to set in string form.- Throws:
DOMException- NO_MODIFICATION_ALLOWED_ERR: Raised if this node is readonly.
-
toString
Return string represents this object. -
appendChild
Adds the node newChild to the end of the list of children of this node.- Specified by:
appendChildin interfaceNode- Parameters:
e- a child element
-
removeChild
Removes the child node indicated by oldChild from the list of children, and returns it.- Specified by:
removeChildin interfaceNode- Parameters:
oldChild- The node being removed.- Returns:
- the node removed.
-
insertBefore
Inserts the node newChild before the child index.- Specified by:
insertBeforein interfaceNode- Parameters:
newChild- the node to insertindex- the reference child index
-
getChildNodes
Return a child.- Specified by:
getChildNodesin interfaceNode- Returns:
- the child
-
getLastChild
The last child of this node. If there is no such node, this returns null.- Returns:
- last child of this node.
-
getFirstChild
The first child of this node. If there is no such node, this returns null.- Returns:
- first child of this node.
-
getParentNode
Return the parent of this node.- Specified by:
getParentNodein interfaceNode- Returns:
- the parent
-
setParentNode
Set a parent of this node.- Specified by:
setParentNodein interfaceNode- Parameters:
e- a node.
-
getCustomProperty
-
setCustomProperty
-
getACustomProperty
-
setACustomProperty
-