public class DefaultElement extends Object implements Element
| Modifier | Constructor and Description |
|---|---|
protected |
DefaultElement(String name) |
protected |
DefaultElement(String name,
String value,
String xmlns) |
| Modifier and Type | Method and Description |
|---|---|
Element |
addChild(Element child)
Add child element to tree and return the added element.
|
boolean |
equals(Object obj) |
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. traverses up to find actual namespace.
|
int |
hashCode() |
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.
|
String |
toString() |
protected DefaultElement(String name)
public Element addChild(Element child) throws XMLException
ElementaddChild in interface Elementchild - Child to add.XMLExceptionpublic Element findChild(String[] elemPath) throws XMLException
findChild in interface ElementXMLExceptionpublic String getAsString() throws XMLException
ElementgetAsString in interface ElementXMLExceptionpublic String getAttribute(String attName) throws XMLException
ElementgetAttribute in interface ElementattName - Name of attribute to fetch.XMLExceptionpublic Map<String,String> getAttributes() throws XMLException
ElementgetAttributes in interface ElementXMLExceptionpublic void setAttributes(Map<String,String> attrs) throws XMLException
ElementsetAttributes in interface Elementattrs - Attributes to set.XMLExceptionpublic Element getChildAfter(Element child) throws XMLException
ElementgetChildAfter in interface Elementchild - The child to look up.XMLExceptionpublic List<Element> getChildren() throws XMLException
ElementgetChildren in interface ElementXMLExceptionpublic List<Element> getChildren(String name) throws XMLException
ElementgetChildren in interface Elementname - Name of the children to get.XMLExceptionpublic List<Element> getChildrenNS(String xmlns) throws XMLException
ElementgetChildrenNS in interface Elementxmlns - Namespace of the children to get.XMLExceptionpublic Element getChildrenNS(String name, String xmlns) throws XMLException
ElementgetChildrenNS in interface Elementname - Name of the children to get.xmlns - Namespace of the children to get.XMLExceptionpublic Element getFirstChild() throws XMLException
ElementgetFirstChild in interface ElementXMLExceptionpublic Element getFirstChild(String name) throws XMLException
getFirstChild in interface ElementXMLExceptionpublic String getName() throws XMLException
ElementgetName in interface ElementXMLExceptionpublic Element getNextSibling() throws XMLException
ElementgetNextSibling in interface ElementXMLExceptionpublic Element getParent() throws XMLException
ElementgetParent in interface ElementXMLExceptionpublic void setParent(Element parent) throws XMLException
ElementsetParent in interface Elementparent - The parent to set for this element.XMLExceptionpublic String getValue() throws XMLException
ElementgetValue in interface ElementXMLExceptionpublic void setValue(String value) throws XMLException
ElementsetValue in interface Elementvalue - Value to set.XMLExceptionpublic String getXMLNS() throws XMLException
ElementgetXMLNS in interface ElementXMLExceptionpublic void setXMLNS(String xmlns) throws XMLException
ElementsetXMLNS in interface Elementxmlns - Namespace to set.XMLExceptionpublic void removeAttribute(String key) throws XMLException
ElementremoveAttribute in interface Elementkey - Name of attribute to remove.XMLExceptionpublic void removeChild(Element child) throws XMLException
ElementremoveChild in interface Elementchild - Child element to remove.XMLExceptionpublic void setAttribute(String key, String value) throws XMLException
ElementsetAttribute in interface Elementkey - Name of attribute to set.value - Value of attribute to set.XMLExceptionCopyright © 2006–2020 Tigase. All rights reserved.