org.apache.tapestry5.dom
Class Document

java.lang.Object
  extended by org.apache.tapestry5.dom.Node
      extended by org.apache.tapestry5.dom.Document

public final class Document
extends Node

The root node of a DOM.


Constructor Summary
Document()
          Builds with an instance of DefaultMarkupModel.
Document(MarkupModel model)
           
Document(MarkupModel model, String encoding)
           
 
Method Summary
 void dtd(String name, String publicId, String systemId)
           
 Element find(String path)
          Finds an element based on a path of element names.
 Document getDocument()
           
 Element getElementById(String id)
          Tries to find an element in this document whose id is specified.
 MarkupModel getMarkupModel()
           
protected  Map<String,String> getNamespaceURIToPrefix()
           
 Element getRootElement()
           
 Element newRootElement(String name)
          Creates the root element for this document, replacing any previous root element.
 Element newRootElement(String namespace, String name)
          Creates a new root element within a namespace.
 void toMarkup(Document document, PrintWriter writer, Map<String,String> namespaceURIToPrefix)
          Implemented by each subclass, with the document passed in for efficiency.
 String toString()
          Invokes Node.toMarkup(PrintWriter), collecting output in a string, which is returned.
 
Methods inherited from class org.apache.tapestry5.dom.Node
getChildMarkup, getChildren, getContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Document

public Document(MarkupModel model)

Document

public Document(MarkupModel model,
                String encoding)

Document

public Document()
Builds with an instance of DefaultMarkupModel.

Method Detail

getDocument

public Document getDocument()
Overrides:
getDocument in class Node

find

public Element find(String path)
Finds an element based on a path of element names.

Parameters:
path - slash separated series of element names
Returns:
the matching element, or null if not found
See Also:
Element.find(String)

getMarkupModel

public MarkupModel getMarkupModel()

newRootElement

public Element newRootElement(String name)
Creates the root element for this document, replacing any previous root element.


newRootElement

public Element newRootElement(String namespace,
                              String name)
Creates a new root element within a namespace.

Parameters:
namespace - URI of namespace containing the element
name - name of element with namespace
Returns:
the root element

toMarkup

public void toMarkup(Document document,
                     PrintWriter writer,
                     Map<String,String> namespaceURIToPrefix)
Description copied from class: Node
Implemented by each subclass, with the document passed in for efficiency.


toString

public String toString()
Description copied from class: Node
Invokes Node.toMarkup(PrintWriter), collecting output in a string, which is returned.

Overrides:
toString in class Node

getRootElement

public Element getRootElement()

getElementById

public Element getElementById(String id)
Tries to find an element in this document whose id is specified.

Parameters:
id - the value of the id attribute of the element being looked for
Returns:
the element if found. null if not found.

dtd

public void dtd(String name,
                String publicId,
                String systemId)

getNamespaceURIToPrefix

protected Map<String,String> getNamespaceURIToPrefix()
Overrides:
getNamespaceURIToPrefix in class Node


Copyright © 2006-2009 Apache Software Foundation. All Rights Reserved.