Package de.pdark.decentxml
Class Element
- java.lang.Object
-
- de.pdark.decentxml.NodeWithChildren
-
- de.pdark.decentxml.Element
-
-
Field Summary
Fields Modifier and Type Field Description static NodeFilter<Element>
ELEMENT_FILTER
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Element
addAttribute(Attribute a)
Element
addAttribute(java.lang.String name, java.lang.String value)
Element
addAttributes(Attribute... attributes)
Element
addNode(int index, Node node)
Element
addNode(Node node)
Element
addNodes(int index, Node... nodes)
Element
addNodes(int index, java.util.Collection<? extends Node> nodes)
Element
addNodes(Node... nodes)
Element
addNodes(java.util.Collection<? extends Node> nodes)
Element
checkMandatoryAttribute(java.lang.String name)
int
childIndexOf(Element element)
Element
clearChildNodes()
Deprecated.Use Element.clearChildren() insteadElement
clearChildren()
Element
clearText()
Element
copy()
Simulate clone()Element
copy(Node orig)
Copy all data fromorig
intothis
Element
createClone()
Simulate clone()Attribute
getAttribute(java.lang.String name)
Attribute
getAttribute(java.lang.String name, Namespace ns)
java.util.Map<java.lang.String,Attribute>
getAttributeMap()
java.util.List<Attribute>
getAttributes()
java.lang.String
getAttributeValue(java.lang.String name)
java.lang.String
getAttributeValue(java.lang.String name, Namespace ns)
java.lang.String
getBeginName()
Element
getChild(int index)
Element
getChild(java.lang.String path)
Find a child element (not a node!) by pathElement
getChild(java.lang.String path, Namespace ns)
java.lang.String
getChildPath()
java.util.List<Element>
getChildren()
java.util.List<Element>
getChildren(java.lang.String name)
java.util.List<Element>
getChildren(java.lang.String name, Namespace ns)
Document
getDocument()
java.lang.String
getEndName()
int
getEndOffset()
java.lang.String
getName()
Namespace
getNamespace()
java.lang.String
getNodePath()
Deprecated.Use Element.getChildPath() insteadjava.lang.String
getNormalizedText()
Parent
getParent()
The parent of this childElement
getParentElement()
java.lang.String
getPostSpace()
Space before the closing bracket of the elementint
getStartOffset()
Token
getStartToken()
java.lang.String
getText()
Get the text from the nodejava.lang.String
getTrimmedText()
XMLTokenizer.Type
getType()
Get the node typeboolean
hasChildren()
boolean
isCompactEmpty()
void
remove()
Element
removeAttribute(java.lang.String name)
Element
setAttribute(Attribute a)
Element
setAttribute(java.lang.String name, java.lang.String value)
Element
setAttribute(java.lang.String name, java.lang.String value, Namespace ns)
Element
setBeginName(java.lang.String beginName)
Element
setCompactEmpty(boolean compactEmpty)
Element
setEndName(java.lang.String endName)
The string to be put into the end tag.Element
setName(java.lang.String name)
void
setNamespace(Namespace namespace)
Element
setParent(Parent parent)
Change the parent of this child.Element
setPostSpace(java.lang.String postSpace)
Element
setText(java.lang.String text)
Change the text of the node.Element
toXML(XMLWriter writer)
Fast way to convert many nodes to XML-
Methods inherited from class de.pdark.decentxml.NodeWithChildren
clearNodes, getNode, getNodes, getNodes, hasNodes, nodeCount, nodeIndexOf, removeNode, removeNode, toString, toXML
-
-
-
-
Field Detail
-
ELEMENT_FILTER
public static final NodeFilter<Element> ELEMENT_FILTER
-
-
Method Detail
-
getStartToken
public Token getStartToken()
-
getStartOffset
public int getStartOffset()
-
getEndOffset
public int getEndOffset()
-
getBeginName
public java.lang.String getBeginName()
-
setBeginName
public Element setBeginName(java.lang.String beginName)
-
getEndName
public java.lang.String getEndName()
-
setEndName
public Element setEndName(java.lang.String endName)
The string to be put into the end tag. This can contain whitespace around the name
-
getPostSpace
public java.lang.String getPostSpace()
Space before the closing bracket of the element
-
setPostSpace
public Element setPostSpace(java.lang.String postSpace)
-
setName
public Element setName(java.lang.String name)
-
getName
public java.lang.String getName()
-
getParent
public Parent getParent()
Description copied from interface:Child
The parent of this child
-
setParent
public Element setParent(Parent parent)
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!
-
addAttribute
public Element addAttribute(java.lang.String name, java.lang.String value)
-
getAttributes
public java.util.List<Attribute> getAttributes()
-
getAttributeMap
public java.util.Map<java.lang.String,Attribute> getAttributeMap()
-
getAttribute
public Attribute getAttribute(java.lang.String name)
-
setAttribute
public Element setAttribute(java.lang.String name, java.lang.String value)
-
setAttribute
public Element setAttribute(java.lang.String name, java.lang.String value, Namespace ns)
-
checkMandatoryAttribute
public Element checkMandatoryAttribute(java.lang.String name)
-
removeAttribute
public Element removeAttribute(java.lang.String name)
-
getAttributeValue
public java.lang.String getAttributeValue(java.lang.String name)
-
getAttributeValue
public java.lang.String getAttributeValue(java.lang.String name, Namespace ns)
-
addNode
public Element addNode(Node node)
- Specified by:
addNode
in interfaceParent
- Overrides:
addNode
in classNodeWithChildren
-
addNode
public Element addNode(int index, Node node)
- Specified by:
addNode
in interfaceParent
- Overrides:
addNode
in classNodeWithChildren
-
addNodes
public Element addNodes(java.util.Collection<? extends Node> nodes)
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
public Element addNodes(int index, java.util.Collection<? extends Node> nodes)
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
public Element addNodes(Node... nodes)
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
addNodes
public Element addNodes(int index, Node... nodes)
- Specified by:
addNodes
in interfaceParent
- Overrides:
addNodes
in classNodeWithChildren
-
setCompactEmpty
public Element setCompactEmpty(boolean compactEmpty)
-
isCompactEmpty
public boolean isCompactEmpty()
-
toXML
public Element toXML(XMLWriter writer) throws java.io.IOException
Description copied from interface:Node
Fast way to convert many nodes to XML- Specified by:
toXML
in interfaceNode
- Overrides:
toXML
in classNodeWithChildren
- Throws:
java.io.IOException
-
getType
public XMLTokenizer.Type getType()
Description copied from interface:Node
Get the node type
-
getChild
public Element getChild(int index)
-
hasChildren
public boolean hasChildren()
-
getChildren
public java.util.List<Element> getChildren()
-
getChildren
public java.util.List<Element> getChildren(java.lang.String name)
-
clearChildNodes
public Element clearChildNodes()
Deprecated.Use Element.clearChildren() instead
-
clearChildren
public Element clearChildren()
-
getText
public java.lang.String getText()
Description copied from interface:TextNode
Get the text from the node
-
getTrimmedText
public java.lang.String getTrimmedText()
-
getNormalizedText
public java.lang.String getNormalizedText()
-
setText
public Element setText(java.lang.String text)
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
public Element clearText()
-
getParentElement
public Element getParentElement()
-
getNodePath
public java.lang.String getNodePath()
Deprecated.Use Element.getChildPath() insteadDescription copied from interface:Child
Return a path which uniquely describes this child.- Specified by:
getNodePath
in interfaceChild
-
getChildPath
public java.lang.String getChildPath()
-
childIndexOf
public int childIndexOf(Element element)
-
getDocument
public Document getDocument()
-
getChild
public Element getChild(java.lang.String path)
Description copied from interface:Parent
Find a child element (not a node!) by path
-
createClone
public Element createClone()
Description copied from interface:Node
Simulate clone()- Specified by:
createClone
in interfaceNode
-
copy
public Element copy(Node orig)
Description copied from interface:Node
Copy all data fromorig
intothis
- Specified by:
copy
in interfaceNode
- Overrides:
copy
in classNodeWithChildren
-
copy
public Element copy()
Description copied from interface:Node
Simulate clone()- Specified by:
copy
in interfaceNode
- Overrides:
copy
in classNodeWithChildren
-
setNamespace
public void setNamespace(Namespace namespace)
-
getNamespace
public Namespace getNamespace()
-
-