Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5.dom
Class Document

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

    public final class Document

extends Node

The root node of a DOM.

Field Summary
`static java.lang.String` | `XML_NAMESPACE_URI` XML Namespace URI.
`static java.lang.String` | `XMLNS_NAMESPACE_URI` Namespace used exclusively for defining namespaces.

Constructor Summary
`Document()` Builds with an instance of `DefaultMarkupModel`.
`Document(MarkupModel model)`
`Document(MarkupModel model, java.lang.String encoding)`

Method Summary
`CData` | `cdata(java.lang.String content)` Adds and returns a new CDATA node.
`Document` | `comment(java.lang.String text)` Adds the comment and returns this document for further construction.
`void` | `dtd(java.lang.String name, java.lang.String publicId, java.lang.String systemId)` Sets the DTD for the document, overriding any prior DTD.
`Element` | `find(java.lang.String path)` Finds an element based on a path of element names.
`Document` | `getDocument()`
`Element` | `getElementById(java.lang.String id)` Tries to find an element in this document whose id is specified.
`MarkupModel` | `getMarkupModel()`
`protected java.util.Map<java.lang.String,java.lang.String>` | `getNamespaceURIToPrefix()`
`Element` | `getRootElement()`
`boolean` | `hasDTD()` Returns true if the document has an explicit DTD (set via `dtd(String, String, String)`).
`Element` | `newRootElement(java.lang.String name)` Creates the root element for this document, replacing any previous root element.
`Element` | `newRootElement(java.lang.String namespace, java.lang.String name)` Creates a new root element within a namespace.
`Document` | `raw(java.lang.String text)` Adds the raw text and returns this document for further construction.
`Text` | `text(java.lang.String text)` Adds and returns a new text node (the text node is returned so that `Text.write(String)` or [@link `Text.writef(String, Object[])` may be invoked.
`void` | `toMarkup(Document document, java.io.PrintWriter writer, java.util.Map<java.lang.String,java.lang.String> namespaceURIToPrefix)` Implemented by each subclass, with the document passed in for efficiency.

Methods inherited from class org.apache.tapestry5.dom.Node
`getContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, toString, wrap`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### XML_NAMESPACE_URI

    public static final java.lang.String XML_NAMESPACE_URI

  XML Namespace URI. May be bound to the "xml" but must not be bound to any other prefix.

  See Also:
    Constant Field Values

### XMLNS_NAMESPACE_URI

    public static final java.lang.String XMLNS_NAMESPACE_URI

  Namespace used exclusively for defining namespaces.

  See Also:
    Constant Field Values

Constructor Detail

### Document

    public Document(MarkupModel model)

### Document

    public Document(MarkupModel model,
                    java.lang.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(java.lang.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(java.lang.String name)

  Creates the root element for this document, replacing any previous root element.

### newRootElement

    public Element newRootElement(java.lang.String namespace,
                                  java.lang.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,
                         java.io.PrintWriter writer,
                         java.util.Map<java.lang.String,java.lang.String> namespaceURIToPrefix)

  Description copied from class: `Node`
  Implemented by each subclass, with the document passed in for efficiency.

### getRootElement

    public Element getRootElement()

### getElementById

    public Element getElementById(java.lang.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(java.lang.String name,
                    java.lang.String publicId,
                    java.lang.String systemId)

  Sets the DTD for the document, overriding any prior DTD.

  Parameters:
    `name` - non-blank name of document type (i.e., "html")
    `publicId` - optional
    `systemId` - optional

### hasDTD

    public boolean hasDTD()

  Returns true if the document has an explicit DTD (set via `dtd(String, String, String)`).

  Since:
    5.3

### getNamespaceURIToPrefix

    protected java.util.Map<java.lang.String,java.lang.String> getNamespaceURIToPrefix()

  Overrides:
    `getNamespaceURIToPrefix` in class `Node`

### comment

    public Document comment(java.lang.String text)

  Adds the comment and returns this document for further construction.

  Since:
    5.1.0.0

### raw

    public Document raw(java.lang.String text)

  Adds the raw text and returns this document for further construction.

  Since:
    5.1.0.0

### text

    public Text text(java.lang.String text)

  Adds and returns a new text node (the text node is returned so that `Text.write(String)` or [@link `Text.writef(String, Object[])` may be invoked.

  Parameters:
    `text` - initial text for the node
  Returns:
    the new Text node

### cdata

    public CData cdata(java.lang.String content)

  Adds and returns a new CDATA node.

  Parameters:
    `content` - the content to be rendered by the node
  Returns:
    the newly created node

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.