Class Document


  • 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.
    • Constructor Detail

      • Document

        public Document()
    • Method Detail

      • getEncoding

        public java.lang.String getEncoding()
        returns "#document"
      • setEncoding

        public void setEncoding​(java.lang.String enc)
      • setStandalone

        public void setStandalone​(java.lang.Boolean standalone)
      • getStandalone

        public java.lang.Boolean getStandalone()
      • getName

        public java.lang.String getName()
      • 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​(org.xmlpull.v1.XmlPullParser parser)
                   throws java.io.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 class Node
        Throws:
        java.io.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 class Node
      • getRootElement

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

        public void write​(org.xmlpull.v1.XmlSerializer writer)
                   throws java.io.IOException
        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 class Node
        Throws:
        java.io.IOException