Package de.pdark.decentxml
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 de.pdark.decentxml.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
The string to be put into the end tag. This can contain whitespace around the name -
getPostSpace
Space before the closing bracket of the element -
setPostSpace
-
setName
-
getName
-
getParent
Description copied from interface:ChildThe parent of this child -
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
- Specified by:
addNodein interfaceParent- Overrides:
addNodein classNodeWithChildren
-
addNode
- Specified by:
addNodein interfaceParent- Overrides:
addNodein classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
addNodes
- Specified by:
addNodesin interfaceParent- Overrides:
addNodesin classNodeWithChildren
-
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
Description copied from interface:TextNodeGet the text from the node -
getTrimmedText
-
getNormalizedText
-
setText
Description copied from interface:TextNodeChange the text of the node. When necessary, the text will be escaped before writing it to the output stream. -
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
Description copied from interface:ParentFind a child element (not a node!) by path -
getChild
-
createClone
Description copied from interface:NodeSimulate clone()- Specified by:
createClonein interfaceNode
-
copy
Description copied from interface:NodeCopy all data fromorigintothis- Specified by:
copyin interfaceNode- Overrides:
copyin classNodeWithChildren
-
copy
Description copied from interface:NodeSimulate clone()- Specified by:
copyin interfaceNode- Overrides:
copyin classNodeWithChildren
-
setNamespace
-
getNamespace
-
remove
public void remove()
-