public interface Element
Modifier and Type | Method and Description |
---|---|
Element |
addChild(Element child)
Add child element to tree and return the added element.
|
Element |
findChild(String[] elemPath) |
String |
getAsString()
Get this element as XML string.
|
String |
getAttribute(String attName)
Get attribute by name.
|
Map<String,String> |
getAttributes()
Get all attributes as a Map.
|
Element |
getChildAfter(Element child)
Gets the first child after specified child in children list.
|
List<Element> |
getChildren()
Get all children of the element.
|
List<Element> |
getChildren(String name)
Get children by name.
|
List<Element> |
getChildrenNS(String xmlns)
Get children by namespace.
|
Element |
getChildrenNS(String name,
String xmlns)
Get children by namespace.
|
Element |
getFirstChild()
Get the first child element of this element.
|
Element |
getFirstChild(String name) |
String |
getName()
Get name of this element.
|
Element |
getNextSibling()
Get next sibling to this element or null if no parent or no more siblings
exist.
|
Element |
getParent()
Get parent element of this element.
|
String |
getValue()
Get element value.
|
String |
getXMLNS()
Get namespace of this element.
|
void |
removeAttribute(String key)
Remove attribute from element.
|
void |
removeChild(Element child)
Remove child from element.
|
void |
setAttribute(String key,
String value)
Set value of attribute.
|
void |
setAttributes(Map<String,String> attrs)
Set a number of attributes.
|
void |
setParent(Element parent)
Set element parent.
|
void |
setValue(String value)
Set value of this element.
|
void |
setXMLNS(String xmlns)
Change the namespace of this element.
|
Element addChild(Element child) throws XMLException
child
- Child to add.XMLException
Element findChild(String[] elemPath) throws XMLException
XMLException
String getAsString() throws XMLException
XMLException
String getAttribute(String attName) throws XMLException
attName
- Name of attribute to fetch.XMLException
Map<String,String> getAttributes() throws XMLException
XMLException
Element getChildAfter(Element child) throws XMLException
child
- The child to look up.XMLException
List<Element> getChildren() throws XMLException
XMLException
List<Element> getChildren(String name) throws XMLException
name
- Name of the children to get.XMLException
List<Element> getChildrenNS(String xmlns) throws XMLException
xmlns
- Namespace of the children to get.XMLException
Element getChildrenNS(String name, String xmlns) throws XMLException
name
- Name of the children to get.xmlns
- Namespace of the children to get.XMLException
Element getFirstChild() throws XMLException
XMLException
Element getFirstChild(String name) throws XMLException
XMLException
String getName() throws XMLException
XMLException
Element getNextSibling() throws XMLException
XMLException
Element getParent() throws XMLException
XMLException
String getValue() throws XMLException
XMLException
String getXMLNS() throws XMLException
XMLException
void removeAttribute(String key) throws XMLException
key
- Name of attribute to remove.XMLException
void removeChild(Element child) throws XMLException
child
- Child element to remove.XMLException
void setAttribute(String key, String value) throws XMLException
key
- Name of attribute to set.value
- Value of attribute to set.XMLException
void setAttributes(Map<String,String> attrs) throws XMLException
attrs
- Attributes to set.XMLException
void setParent(Element parent) throws XMLException
parent
- The parent to set for this element.XMLException
void setValue(String value) throws XMLException
value
- Value to set.XMLException
void setXMLNS(String xmlns) throws XMLException
xmlns
- Namespace to set.XMLException
Copyright © 2006–2015 Tigase. All rights reserved.