Package org.kxml2.kdom
Class Document
java.lang.Object
org.kxml2.kdom.Node
org.kxml2.kdom.Document
The document consists of some legacy events and a single root
element. This class basically adds some consistency checks to
Node.
-
Field Summary
Fields inherited from class org.kxml2.kdom.Node
CDSECT, COMMENT, DOCDECL, DOCUMENT, ELEMENT, ENTITY_REF, IGNORABLE_WHITESPACE, PROCESSING_INSTRUCTION, TEXT
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a child at the given index position.returns "#document"getName()
returns the root element of this document.void
parse
(org.xmlpull.v1.XmlPullParser parser) reads the document and checks if the last event is END_DOCUMENT.void
removeChild
(int index) Removes the child object at the given indexvoid
setEncoding
(String enc) void
setStandalone
(Boolean standalone) void
write
(org.xmlpull.v1.XmlSerializer writer) Writes this node to the given XmlWriter.Methods inherited from class org.kxml2.kdom.Node
addChild, createElement, getChild, getChildCount, getElement, getElement, getText, getType, indexOf, isText, writeChildren
-
Constructor Details
-
Document
public Document()
-
-
Method Details
-
getEncoding
returns "#document" -
setEncoding
-
setStandalone
-
getStandalone
-
getName
-
addChild
Adds a child at the given index position. Throws an exception when a second root element is added -
parse
public void parse(org.xmlpull.v1.XmlPullParser parser) throws IOException, org.xmlpull.v1.XmlPullParserException 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 ().- Overrides:
parse
in classNode
- Throws:
IOException
org.xmlpull.v1.XmlPullParserException
-
removeChild
public void removeChild(int index) Description copied from class:Node
Removes the child object at the given index- Overrides:
removeChild
in classNode
-
getRootElement
returns the root element of this document. -
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.- Overrides:
write
in classNode
- Throws:
IOException
-