org.kxml.kdom
Class Document

java.lang.Object
  extended byorg.kxml.kdom.Node
      extended byorg.kxml.kdom.Document
All Implemented Interfaces:
XmlIO

public class Document
extends Node

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


Field Summary
protected  int rootIndex
           
 
Fields inherited from class org.kxml.kdom.Node
children, types
 
Constructor Summary
Document()
           
 
Method Summary
 void addChild(int index, int type, java.lang.Object child)
          Adds a child at the given index position.
 java.lang.String getName()
          returns "#document"
 Element getRootElement()
          returns the root element of this document.
 void parse(AbstractXmlParser parser)
          reads the document and checks if the last event is END_DOCUMENT.
 void removeChild(int index)
          Removes the child object at the given index
 
Methods inherited from class org.kxml.kdom.Node
addChild, createElement, getChild, getChildCount, getElement, getElement, getElement, getNamespace, getText, getText, getType, indexOf, indexOf, toString, write, writeChildren
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

rootIndex

protected int rootIndex
Constructor Detail

Document

public Document()
Method Detail

getName

public java.lang.String getName()
returns "#document"

Overrides:
getName in class Node

addChild

public void addChild(int index,
                     int type,
                     java.lang.Object child)
Adds a child at the given index position. Throws an exception when a second root element is added

Overrides:
addChild in class Node

parse

public void parse(AbstractXmlParser parser)
           throws java.io.IOException
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 ().

Specified by:
parse in interface XmlIO
Overrides:
parse in class Node
Throws:
java.io.IOException

removeChild

public void removeChild(int index)
Description copied from class: Node
Removes the child object at the given index

Overrides:
removeChild in class Node

getRootElement

public Element getRootElement()
returns the root element of this document.