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) int
childIndexOf
(Element element) Deprecated.Use Element.clearChildren() insteadcopy()
Simulate clone()Copy all data fromorig
intothis
Simulate 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) int
getName()
Deprecated.Use Element.getChildPath() insteadThe parent of this childSpace before the closing bracket of the elementint
getText()
Get the text from the nodegetType()
Get the node typeboolean
boolean
void
remove()
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.void
setNamespace
(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:Child
The parent of this child -
setParent
Description copied from interface:Child
Change 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:
addNode
in interfaceParent
- Overrides:
addNode
in classNodeWithChildren
-
addNode
- Specified by:
addNode
in interfaceParent
- Overrides:
addNode
in classNodeWithChildren
-
addNodes
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
setCompactEmpty
-
isCompactEmpty
public boolean isCompactEmpty() -
toXML
Description copied from interface:Node
Fast way to convert many nodes to XML- Specified by:
toXML
in interfaceNode
- Overrides:
toXML
in classNodeWithChildren
- Throws:
IOException
-
getType
Description copied from interface:Node
Get the node type -
getChild
-
hasChildren
public boolean hasChildren() -
getChildren
-
getChildren
-
getChildren
-
clearChildNodes
Deprecated.Use Element.clearChildren() instead -
clearChildren
-
getText
Description copied from interface:TextNode
Get the text from the node -
getTrimmedText
-
getNormalizedText
-
setText
Description copied from interface:TextNode
Change 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:Child
Return a path which uniquely describes this child.- Specified by:
getNodePath
in interfaceChild
-
getChildPath
-
childIndexOf
-
getDocument
-
getChild
Description copied from interface:Parent
Find a child element (not a node!) by path -
getChild
-
createClone
Description copied from interface:Node
Simulate clone()- Specified by:
createClone
in interfaceNode
-
copy
Description copied from interface:Node
Copy all data fromorig
intothis
- Specified by:
copy
in interfaceNode
- Overrides:
copy
in classNodeWithChildren
-
copy
Description copied from interface:Node
Simulate clone()- Specified by:
copy
in interfaceNode
- Overrides:
copy
in classNodeWithChildren
-
setNamespace
-
getNamespace
-
remove
public void remove()
-