Top Description Fields Constructors Methods
org.kxml2.kdom

public Class Element

extends Node
Class Inheritance
Imports
java.io.*, java.util.*, org.xmlpull.v1.*

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.

Field Summary

Modifier and TypeField and Description
protected Vector<E>
protected String
protected String
protected Node
protected Vector<E>
Inherited from org.kxml2.kdom.Node:
CDSECTchildrenCOMMENTDOCDECLDOCUMENTELEMENTENTITY_REFIGNORABLE_WHITESPACEPROCESSING_INSTRUCTIONTEXTtypes

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
clear()

removes all children and attributes

public Element
createElement(String namespace, String name)

Overrides org.kxml2.kdom.Node.createElement.

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
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
public String
getNamespaceUri(String prefix)

returns the namespace for the given prefix

public String
public Node
getParent()

Returns the parent node of this element

public Node
getRoot()

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.

public void
parse(XmlPullParser parser)

Overrides org.kxml2.kdom.Node.parse.

Builds the child elements from the given Parser.
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.

protected void
setParent(Node parent)

Sets the Parent of this element.

public void
setPrefix(String prefix, String namespace)

Sets the given prefix; a namespace value of null removess the prefix

public void
write(XmlSerializer writer)

Overrides org.kxml2.kdom.Node.write.

Writes this element and all children to the given XmlWriter.
Inherited from org.kxml2.kdom.Node:
addChildaddChildgetChildgetChildCountgetElementgetElementgetTextgetTypeindexOfisTextremoveChildwriteChildren

Field Detail

attributesback to summary
protected Vector<E> attributes
nameback to summary
protected String name
namespaceback to summary
protected String namespace
parentback to summary
protected Node parent
prefixesback to summary
protected Vector<E> prefixes

Constructor Detail

Elementback to summary
public Element()

Method Detail

clearback to summary
public void clear()

removes all children and attributes

createElementback to summary
public Element createElement(String namespace, String name)

Overrides org.kxml2.kdom.Node.createElement.

Forwards creation request to parent if any, otherwise calls super.createElement.

getAttributeCountback to summary
public int getAttributeCount()

Returns the number of attributes of this element.

getAttributeNameback to summary
public String getAttributeName(int index)
getAttributeNamespaceback to summary
public String getAttributeNamespace(int index)
getAttributeValueback to summary
public String getAttributeValue(int index)
getAttributeValueback to summary
public String getAttributeValue(String namespace, String name)
getNameback to summary
public String getName()

returns the (local) name of the element

getNamespaceback to summary
public String getNamespace()

returns the namespace of the element

getNamespaceCountback to summary
public int getNamespaceCount()

returns the number of declared namespaces, NOT including parent elements

getNamespacePrefixback to summary
public String getNamespacePrefix(int i)
getNamespaceUriback to summary
public String getNamespaceUri(String prefix)

returns the namespace for the given prefix

getNamespaceUriback to summary
public String getNamespaceUri(int i)
getParentback to summary
public Node getParent()

Returns the parent node of this element

getRootback to summary
public Node getRoot()

Returns the root node, determined by ascending to the all parents un of the root element.

initback to summary
public void init()

called when all properties are set, but before children are parsed. Please do not use setParent for initialization code any longer.

parseback to summary
public void parse(XmlPullParser parser) throws IOException, XmlPullParserException

Overrides org.kxml2.kdom.Node.parse.

Builds the child elements from the given Parser. By overwriting parse, an element can take complete control over parsing its subtree.

setAttributeback to summary
public void setAttribute(String namespace, String name, String value)

Sets the given attribute; a value of null removes the attribute

setNameback to summary
public void setName(String name)

sets the name of the element

setNamespaceback to summary
public void setNamespace(String namespace)

sets the namespace of the element.

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.

setParentback to summary
protected void setParent(Node parent)

Sets the Parent of this element. Automatically called from the add method. Please use with care, you can simply create inconsitencies in the document tree structure using this method!

setPrefixback to summary
public void setPrefix(String prefix, String namespace)

Sets the given prefix; a namespace value of null removess the prefix

writeback to summary
public void write(XmlSerializer writer) throws IOException

Overrides org.kxml2.kdom.Node.write.

Writes this element and all children to the given XmlWriter.