public class Element extends Node
Modifier and Type | Field and Description |
---|---|
protected Vector |
attributes |
protected String |
name |
protected String |
namespace |
protected Node |
parent |
protected Vector |
prefixes |
CDSECT, children, COMMENT, DOCDECL, DOCUMENT, ELEMENT, ENTITY_REF, IGNORABLE_WHITESPACE, PROCESSING_INSTRUCTION, TEXT, types
Constructor and Description |
---|
Element() |
Modifier and Type | Method and Description |
---|---|
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(int i) |
String |
getNamespaceUri(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(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.
|
protected void |
setParent(Node parent)
Sets the Parent of this 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.
|
addChild, addChild, getChild, getChildCount, getElement, getElement, getText, getType, indexOf, isText, removeChild, writeChildren
protected Vector attributes
protected String name
protected String namespace
protected Node parent
protected Vector prefixes
public void clear()
public Element createElement(String namespace, String name)
createElement
in class Node
public int getAttributeCount()
public String getAttributeName(int index)
public String getAttributeNamespace(int index)
public String getAttributeValue(int index)
public String getName()
public String getNamespace()
public int getNamespaceCount()
public String getNamespacePrefix(int i)
public String getNamespaceUri(int i)
public String getNamespaceUri(String prefix)
public Node getParent()
public Node getRoot()
public void init()
public void parse(XmlPullParser parser) throws IOException, XmlPullParserException
parse
in class Node
IOException
XmlPullParserException
public void setAttribute(String namespace, String name, String value)
public void setName(String name)
public void setNamespace(String namespace)
protected void setParent(Node parent)
public void setPrefix(String prefix, String namespace)
public void write(XmlSerializer writer) throws IOException
write
in class Node
IOException