Knopflerfish OSGi 5.2.0

org.kxml2.kdom
Class Element

java.lang.Object
  extended by org.kxml2.kdom.Node
      extended by org.kxml2.kdom.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.


Field Summary
protected  java.util.Vector<java.lang.String[]> attributes
           
protected  java.lang.String name
           
protected  java.lang.String namespace
           
protected  Node parent
           
protected  java.util.Vector<java.lang.String[]> prefixes
           
 
Fields inherited from class org.kxml2.kdom.Node
CDSECT, children, COMMENT, DOCDECL, DOCUMENT, ELEMENT, ENTITY_REF, IGNORABLE_WHITESPACE, PROCESSING_INSTRUCTION, TEXT, types
 
Constructor Summary
Element()
           
 
Method Summary
 void clear()
          removes all children and attributes
 Element createElement(java.lang.String namespace, java.lang.String name)
          Forwards creation request to parent if any, otherwise calls super.createElement.
 int getAttributeCount()
          Returns the number of attributes of this element.
 java.lang.String getAttributeName(int index)
           
 java.lang.String getAttributeNamespace(int index)
           
 java.lang.String getAttributeValue(int index)
           
 java.lang.String getAttributeValue(java.lang.String namespace, java.lang.String name)
           
 java.lang.String getName()
          returns the (local) name of the element
 java.lang.String getNamespace()
          returns the namespace of the element
 int getNamespaceCount()
          returns the number of declared namespaces, NOT including parent elements
 java.lang.String getNamespacePrefix(int i)
           
 java.lang.String getNamespaceUri(int i)
           
 java.lang.String getNamespaceUri(java.lang.String prefix)
          returns the namespace for the given prefix
 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(org.xmlpull.v1.XmlPullParser parser)
          Builds the child elements from the given Parser.
 void setAttribute(java.lang.String namespace, java.lang.String name, java.lang.String value)
          Sets the given attribute; a value of null removes the attribute
 void setName(java.lang.String name)
          sets the name of the element
 void setNamespace(java.lang.String namespace)
          sets the namespace of the element.
protected  void setParent(Node parent)
          Sets the Parent of this element.
 void setPrefix(java.lang.String prefix, java.lang.String namespace)
          Sets the given prefix; a namespace value of null removess the prefix
 void write(org.xmlpull.v1.XmlSerializer writer)
          Writes this element and all children to the given XmlWriter.
 
Methods inherited from class org.kxml2.kdom.Node
addChild, addChild, getChild, getChildCount, getElement, getElement, getText, getType, indexOf, isText, removeChild, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

namespace

protected java.lang.String namespace

name

protected java.lang.String name

attributes

protected java.util.Vector<java.lang.String[]> attributes

parent

protected Node parent

prefixes

protected java.util.Vector<java.lang.String[]> prefixes
Constructor Detail

Element

public Element()
Method Detail

init

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


clear

public void clear()
removes all children and attributes


createElement

public Element createElement(java.lang.String namespace,
                             java.lang.String name)
Forwards creation request to parent if any, otherwise calls super.createElement.

Overrides:
createElement in class Node

getAttributeCount

public int getAttributeCount()
Returns the number of attributes of this element.


getAttributeNamespace

public java.lang.String getAttributeNamespace(int index)

getAttributeName

public java.lang.String getAttributeName(int index)

getAttributeValue

public java.lang.String getAttributeValue(int index)

getAttributeValue

public java.lang.String getAttributeValue(java.lang.String namespace,
                                          java.lang.String name)

getRoot

public Node getRoot()
Returns the root node, determined by ascending to the all parents un of the root element.


getName

public java.lang.String getName()
returns the (local) name of the element


getNamespace

public java.lang.String getNamespace()
returns the namespace of the element


getNamespaceUri

public java.lang.String getNamespaceUri(java.lang.String prefix)
returns the namespace for the given prefix


getNamespaceCount

public int getNamespaceCount()
returns the number of declared namespaces, NOT including parent elements


getNamespacePrefix

public java.lang.String getNamespacePrefix(int i)

getNamespaceUri

public java.lang.String getNamespaceUri(int i)

getParent

public Node getParent()
Returns the parent node of this element


parse

public void parse(org.xmlpull.v1.XmlPullParser parser)
           throws java.io.IOException,
                  org.xmlpull.v1.XmlPullParserException
Builds the child elements from the given Parser. By overwriting parse, an element can take complete control over parsing its subtree.

Overrides:
parse in class Node
Throws:
java.io.IOException
org.xmlpull.v1.XmlPullParserException

setAttribute

public void setAttribute(java.lang.String namespace,
                         java.lang.String name,
                         java.lang.String value)
Sets the given attribute; a value of null removes the attribute


setPrefix

public void setPrefix(java.lang.String prefix,
                      java.lang.String namespace)
Sets the given prefix; a namespace value of null removess the prefix


setName

public void setName(java.lang.String name)
sets the name of the element


setNamespace

public void setNamespace(java.lang.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.


setParent

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!


write

public void write(org.xmlpull.v1.XmlSerializer writer)
           throws java.io.IOException
Writes this element and all children to the given XmlWriter.

Overrides:
write in class Node
Throws:
java.io.IOException

Knopflerfish OSGi 5.2.0