Top Description Fields Constructors Methods
org.kxml2.kdom

public Class Document

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

The document consists of some legacy events and a single root element. This class basically adds some consistency checks to Node.

Field Summary

Modifier and TypeField and Description
pack-priv String
protected int
pack-priv Boolean
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
addChild(int index, int type, Object child)

Overrides org.kxml2.kdom.Node.addChild.

Adds a child at the given index position.
public String
getEncoding()

returns "#document"

public String
public Element
getRootElement()

returns the root element of this document.

public Boolean
public void
parse(XmlPullParser parser)

Overrides org.kxml2.kdom.Node.parse.

reads the document and checks if the last event is END_DOCUMENT.
public void
removeChild(int index)

Overrides org.kxml2.kdom.Node.removeChild.

Removes the child object at the given index
public void
public void
setStandalone(Boolean standalone)

public void
write(XmlSerializer writer)

Overrides org.kxml2.kdom.Node.write.

Writes this node to the given XmlWriter.
Inherited from org.kxml2.kdom.Node:
addChildcreateElementgetChildgetChildCountgetElementgetElementgetTextgetTypeindexOfisTextwriteChildren

Field Detail

encodingback to summary
pack-priv String encoding
rootIndexback to summary
protected int rootIndex
standaloneback to summary
pack-priv Boolean standalone

Constructor Detail

Documentback to summary
public Document()

Method Detail

addChildback to summary
public void addChild(int index, int type, Object child)

Overrides org.kxml2.kdom.Node.addChild.

Adds a child at the given index position. Throws an exception when a second root element is added

getEncodingback to summary
public String getEncoding()

returns "#document"

getNameback to summary
public String getName()
getRootElementback to summary
public Element getRootElement()

returns the root element of this document.

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

Overrides org.kxml2.kdom.Node.parse.

reads the document and checks if the last event is END_DOCUMENT. If not, an exception is thrown. The end event is consumed. For parsing partial XML structures, consider using Node.parse ().

removeChildback to summary
public void removeChild(int index)

Overrides org.kxml2.kdom.Node.removeChild.

Doc from org.kxml2.kdom.Node.removeChild.

Removes the child object at the given index

setEncodingback to summary
public void setEncoding(String enc)
setStandaloneback to summary
public void setStandalone(Boolean standalone)
writeback to summary
public void write(XmlSerializer writer) throws IOException

Overrides org.kxml2.kdom.Node.write.

Writes this node to the given XmlWriter. For node and document, this method is identical to writeChildren, except that the stream is flushed automatically.