org.attoparser.markup.dom
Class Document

Object
  extended by org.attoparser.markup.dom.Document
All Implemented Interfaces:
Serializable

public final class Document
extends Object
implements Serializable

An attoDOM document, obtained from parsing a document using a DOMMarkupAttoHandler handler object.

Note that attoDOM trees are mutable.

Since:
1.0
Author:
Daniel Fernández
See Also:
Serialized Form

Constructor Summary
Document()
           
 
Method Summary
 DocType getDocType()
           Return the DOCTYPE clause found at the document, if it exists.
 Element getRootElement()
           Returns the only Element root node.
 List<Node> getRootNodes()
           Returns the document root nodes.
 XmlDeclaration getXmlDeclaration()
           Return the XML Declaration found at the document, if it exists.
 int numRootNodes()
           Returns the number of root nodes.
 void visit(AttoDOMVisitor visitor)
           Apply a visitor (implementation of AttoDOMVisitorException) to this document, traversing all its nodes.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Document

public Document()
Method Detail

getXmlDeclaration

public XmlDeclaration getXmlDeclaration()

Return the XML Declaration found at the document, if it exists.

Returns:
the XML declaration, or null if none was found.

getDocType

public DocType getDocType()

Return the DOCTYPE clause found at the document, if it exists.

Returns:
the DOCTYPE clause, or null if none was found.

numRootNodes

public final int numRootNodes()

Returns the number of root nodes. Only one of them can be an Element.

Returns:
the number of root nodes.

getRootNodes

public final List<Node> getRootNodes()

Returns the document root nodes. The returned list is immutable.

Returns:
the root nodes.

getRootElement

public final Element getRootElement()

Returns the only Element root node.

Returns:
the root Element.

visit

public final void visit(AttoDOMVisitor visitor)
                 throws AttoDOMVisitorException

Apply a visitor (implementation of AttoDOMVisitorException) to this document, traversing all its nodes.

A typical visitor implementation is MarkupWriterAttoDOMVisitor.

Parameters:
visitor - the visitor to be applied
Throws:
AttoDOMVisitorException


Copyright © 2012 The ATTOPARSER team. All Rights Reserved.