| java.lang.Object org.kxml2.kdom.Node
All known Subclasses: org.kxml2.kdom.Element, org.kxml2.kdom.Document,
Node | public class Node (Code) | | A common base class for Document and Element, also used for
storing XML fragments.
|
Method Summary | |
public void | addChild(int index, int type, Object child) inserts the given child object of the given type at the
given index. | public void | addChild(int type, Object child) | public Element | createElement(String namespace, String name) Builds a default element with the given properties. | public Object | getChild(int index) Returns the child object at the given index. | public int | getChildCount() | public Element | getElement(int index) returns the element at the given index. | public Element | getElement(String namespace, String name) Returns the element with the given namespace and name. | public String | getText(int index) Returns the text node with the given index or null if the node
with the given index is not a text node. | public int | getType(int index) Returns the type of the child at the given index. | public int | indexOf(String namespace, String name, int startIndex) Performs search for an element with the given namespace and
name, starting at the given start index. | public boolean | isText(int i) | public void | parse(XmlPullParser parser) Recursively builds the child elements from the given parser
until an end tag or end document is found. | public void | removeChild(int idx) | public void | write(XmlSerializer writer) Writes this node to the given XmlWriter. | public void | writeChildren(XmlSerializer writer) Writes the children of this node to the given XmlWriter. |
CDSECT | final public static int CDSECT(Code) | | |
COMMENT | final public static int COMMENT(Code) | | |
DOCDECL | final public static int DOCDECL(Code) | | |
DOCUMENT | final public static int DOCUMENT(Code) | | |
ELEMENT | final public static int ELEMENT(Code) | | |
ENTITY_REF | final public static int ENTITY_REF(Code) | | |
IGNORABLE_WHITESPACE | final public static int IGNORABLE_WHITESPACE(Code) | | |
PROCESSING_INSTRUCTION | final public static int PROCESSING_INSTRUCTION(Code) | | |
TEXT | final public static int TEXT(Code) | | |
addChild | public void addChild(int index, int type, Object child)(Code) | | inserts the given child object of the given type at the
given index.
|
addChild | public void addChild(int type, Object child)(Code) | | convenience method for addChild (getChildCount (), child)
|
createElement | public Element createElement(String namespace, String name)(Code) | | Builds a default element with the given properties. Elements
should always be created using this method instead of the
constructor in order to enable construction of specialized
subclasses by deriving custom Document classes. 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.
|
getChild | public Object getChild(int index)(Code) | | Returns the child object at the given index. For child
elements, an Element object is returned. For all other child
types, a String is returned.
|
getChildCount | public int getChildCount()(Code) | | Returns the number of child objects
|
getElement | public Element getElement(int index)(Code) | | returns the element at the given index. If the node at the
given index is a text node, null is returned
|
getElement | public Element getElement(String namespace, String name)(Code) | | Returns the element with the given namespace and name. If the
element is not found, or more than one matching elements are
found, an exception is thrown.
|
getText | public String getText(int index)(Code) | | Returns the text node with the given index or null if the node
with the given index is not a text node.
|
getType | public int getType(int index)(Code) | | Returns the type of the child at the given index. Possible
types are ELEMENT, TEXT, COMMENT, and PROCESSING_INSTRUCTION
|
indexOf | public int indexOf(String namespace, String name, int startIndex)(Code) | | Performs search for an element with the given namespace and
name, starting at the given start index. A null namespace
matches any namespace, please use Xml.NO_NAMESPACE for no
namespace). returns -1 if no matching element was found.
|
isText | public boolean isText(int i)(Code) | | |
parse | public void parse(XmlPullParser parser) throws IOException, XmlPullParserException(Code) | | Recursively builds the child elements from the given parser
until an end tag or end document is found.
The end tag is not consumed.
|
removeChild | public void removeChild(int idx)(Code) | | Removes the child object at the given index
|
write | public void write(XmlSerializer writer) throws IOException(Code) | | Writes this node to the given XmlWriter. For node and document,
this method is identical to writeChildren, except that the
stream is flushed automatically.
|
writeChildren | public void writeChildren(XmlSerializer writer) throws IOException(Code) | | Writes the children of this node to the given XmlWriter.
|
|
|