Class Element
java.lang.Object
de.pdark.decentxml.NodeWithChildren
de.pdark.decentxml.Element
An element in a XML document.
Elements can have attributes and they have children like a document.
- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddAttribute(String name, String value) addAttributes(Attribute... attributes) addNodes(int index, Collection<? extends Node> nodes) addNodes(Collection<? extends Node> nodes) intchildIndexOf(Element element) Deprecated.Use Element.clearChildren() insteadcopy()Simulate clone()Copy all data fromorigintothisSimulate clone()getAttribute(String name) getAttribute(String name, Namespace ns) getAttributeValue(String name) getAttributeValue(String name, Namespace ns) getChild(int index) Find a child element (not a node!) by pathgetChildren(String name) getChildren(String name, Namespace ns) intgetName()Deprecated.Use Element.getChildPath() insteadThe parent of this childSpace before the closing bracket of the elementintgetText()Get the text from the nodegetType()Get the node typebooleanbooleanvoidremove()removeAttribute(String name) setAttribute(String name, String value) setAttribute(String name, String value, Namespace ns) setBeginName(String beginName) setCompactEmpty(boolean compactEmpty) setEndName(String endName) The string to be put into the end tag.voidsetNamespace(Namespace namespace) Change the parent of this child.setPostSpace(String postSpace) Change the text of the node.Fast way to convert many nodes to XMLMethods inherited from class NodeWithChildren
clearNodes, getNode, getNodes, getNodes, hasNodes, nodeCount, nodeIndexOf, removeNode, removeNode, toString, toXML
-
Field Details
-
startToken
-
namespace
-
beginName
-
postSpace
-
endName
-
name
-
parent
-
attributeMap
-
compactEmpty
private boolean compactEmpty -
ELEMENT_FILTER
-
-
Constructor Details
-
Element
-
Element
-
Element
-
Element
-
Element
-
-
Method Details
-
getStartToken
-
getStartOffset
public int getStartOffset() -
getEndOffset
public int getEndOffset() -
getBeginName
-
setBeginName
-
getEndName
-
setEndName
-
getPostSpace
Space before the closing bracket of the element -
setPostSpace
-
setName
-
getName
-
getParent
-
setParent
Description copied from interface:ChildChange the parent of this child.CAUTION: If the child is already attached to a parent, this call will not detach the old relation! You must call
child.getParent().removeNode (child), first! -
addAttributes
-
addAttribute
-
addAttribute
-
setAttribute
-
getAttributes
-
getAttributeMap
-
getAttribute
-
getAttribute
-
setAttribute
-
setAttribute
-
checkMandatoryAttribute
-
removeAttribute
-
getAttributeValue
-
getAttributeValue
-
addNode
-
addNode
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
-
addNodes
-
setCompactEmpty
-
isCompactEmpty
public boolean isCompactEmpty() -
toXML
Description copied from interface:NodeFast way to convert many nodes to XML- Specified by:
toXMLin interfaceNode- Overrides:
toXMLin classNodeWithChildren- Throws:
IOException
-
getType
Description copied from interface:NodeGet the node type -
getChild
-
hasChildren
public boolean hasChildren() -
getChildren
-
getChildren
-
getChildren
-
clearChildNodes
Deprecated.Use Element.clearChildren() instead -
clearChildren
-
getText
-
getTrimmedText
-
getNormalizedText
-
setText
-
clearText
-
getParentElement
-
getNodePath
Deprecated.Use Element.getChildPath() insteadDescription copied from interface:ChildReturn a path which uniquely describes this child.- Specified by:
getNodePathin interfaceChild
-
getChildPath
-
childIndexOf
-
getDocument
-
getChild
-
getChild
-
createClone
Description copied from interface:NodeSimulate clone()- Specified by:
createClonein interfaceNode
-
copy
-
copy
-
setNamespace
-
getNamespace
-
remove
-