org.kxml2.kdom
Class Element
public
class
Element
extends Node
In order to create an element, please use the createElement method
instead of invoking the constructor directly. The right place to
add user defined initialization code is the init method.
Method Summary |
void | clear()
removes all children and attributes |
Element | createElement(String namespace, String name)
Forwards creation request to parent if any, otherwise
calls super.createElement. |
int | getAttributeCount()
Returns the number of attributes of this element. |
String | getAttributeName(int index) |
String | getAttributeNamespace(int index) |
String | getAttributeValue(int index) |
String | getAttributeValue(String namespace, String name) |
String | getName()
returns the (local) name of the element |
String | getNamespace()
returns the namespace of the element |
int | getNamespaceCount()
returns the number of declared namespaces, NOT including
parent elements |
String | getNamespacePrefix(int i) |
String | getNamespaceUri(String prefix)
returns the namespace for the given prefix |
String | getNamespaceUri(int i) |
Node | getParent()
Returns the parent node of this element |
Node | getRoot()
Returns the root node, determined by ascending to the
all parents un of the root element. |
void | init()
called when all properties are set, but before children
are parsed. |
void | parse(XmlPullParser parser)
Builds the child elements from the given Parser. |
void | setAttribute(String namespace, String name, String value)
Sets the given attribute; a value of null removes the attribute |
void | setName(String name)
sets the name of the element |
void | setNamespace(String namespace)
sets the namespace of the element. |
void | setPrefix(String prefix, String namespace)
Sets the given prefix; a namespace value of null removess the
prefix |
void | write(XmlSerializer writer)
Writes this element and all children to the given XmlWriter. |
public Element()
public void clear()
removes all children and attributes
public
Element createElement(String namespace, String name)
Forwards creation request to parent if any, otherwise
calls super.createElement.
public int getAttributeCount()
Returns the number of attributes of this element.
public String getAttributeName(int index)
public String getAttributeNamespace(int index)
public String getAttributeValue(int index)
public String getAttributeValue(String namespace, String name)
public String getName()
returns the (local) name of the element
public String getNamespace()
returns the namespace of the element
public int getNamespaceCount()
returns the number of declared namespaces, NOT including
parent elements
public String getNamespacePrefix(int i)
public String getNamespaceUri(String prefix)
returns the namespace for the given prefix
public String getNamespaceUri(int i)
Returns the parent node of this element
Returns the root node, determined by ascending to the
all parents un of the root element.
public void init()
called when all properties are set, but before children
are parsed. Please do not use setParent for initialization
code any longer.
public void parse(XmlPullParser parser)
Builds the child elements from the given Parser. By overwriting
parse, an element can take complete control over parsing its
subtree.
public void setAttribute(String namespace, String name, String value)
Sets the given attribute; a value of null removes the attribute
public void setName(String name)
sets the name of the element
public void setNamespace(String namespace)
sets the namespace of the element. Please note: For no
namespace, please use Xml.NO_NAMESPACE, null is not a legal
value. Currently, null is converted to Xml.NO_NAMESPACE, but
future versions may throw an exception.
public void setPrefix(String prefix, String namespace)
Sets the given prefix; a namespace value of null removess the
prefix
public void write(XmlSerializer writer)
Writes this element and all children to the given XmlWriter.