Package org.apache.tapestry5.dom
Class Document
java.lang.Object
org.apache.tapestry5.dom.Node
org.apache.tapestry5.dom.Document
The root node of a DOM.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDocument()
Builds with an instance ofDefaultMarkupModel
.Document
(MarkupModel model) Same as Document(model, null).Document
(MarkupModel model, String encoding) Same as Document(model, encoding, null).Document
(MarkupModel model, String encoding, String mimeType) Creates a document instance with a given markup model, encoding and MIME type. -
Method Summary
Modifier and TypeMethodDescriptionAdds and returns a new CDATA node.Adds the comment and returns this document for further construction.void
Sets the DTD for the document, overriding any prior DTD.Finds an element based on a path of element names.getElementById
(String id) Tries to find an element in this document whose id is specified.Returns the MIME type of this document.boolean
hasDTD()
Returns true if the document has an explicit DTD (set viadtd(String, String, String)
).newRootElement
(String name) Creates the root element for this document, replacing any previous root element.newRootElement
(String namespace, String name) Creates a new root element within a namespace.Adds the raw text and returns this document for further construction.Adds and returns a new text node (the text node is returned so thatText.write(String)
or [@linkText.writef(String, Object[])
may be invoked.void
Methods inherited from class org.apache.tapestry5.dom.Node
getContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, toString, wrap
-
Field Details
-
XML_NAMESPACE_URI
XML Namespace URI. May be bound to the "xml" but must not be bound to any other prefix.- See Also:
-
XMLNS_NAMESPACE_URI
Namespace used exclusively for defining namespaces.- See Also:
-
-
Constructor Details
-
Document
Same as Document(model, null).- Parameters:
model
- aMarkupModel
.
-
Document
Same as Document(model, encoding, null).- Parameters:
model
- aMarkupModel
.
-
Document
Creates a document instance with a given markup model, encoding and MIME type.- Parameters:
model
- aMarkupModel
.encoding
- the encoding.mimeType
- the MIME type.- Since:
- 5.4
-
Document
public Document()Builds with an instance ofDefaultMarkupModel
.
-
-
Method Details
-
getDocument
- Overrides:
getDocument
in classNode
-
find
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:
-
getMarkupModel
-
newRootElement
Creates the root element for this document, replacing any previous root element. -
newRootElement
Creates a new root element within a namespace.- Parameters:
namespace
- URI of namespace containing the elementname
- name of element with namespace- Returns:
- the root element
-
toMarkup
-
getRootElement
-
getElementById
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
Sets the DTD for the document, overriding any prior DTD.- Parameters:
name
- non-blank name of document type (i.e., "html")publicId
- optionalsystemId
- optional
-
hasDTD
Returns true if the document has an explicit DTD (set viadtd(String, String, String)
).- Since:
- 5.3
-
getNamespaceURIToPrefix
- Overrides:
getNamespaceURIToPrefix
in classNode
-
comment
Adds the comment and returns this document for further construction.- Since:
- 5.1.0.0
-
raw
Adds the raw text and returns this document for further construction.- Since:
- 5.1.0.0
-
text
Adds and returns a new text node (the text node is returned so thatText.write(String)
or [@linkText.writef(String, Object[])
may be invoked.- Parameters:
text
- initial text for the node- Returns:
- the new Text node
-
cdata
Adds and returns a new CDATA node.- Parameters:
content
- the content to be rendered by the node- Returns:
- the newly created node
-
getMimeType
Returns the MIME type of this document.- Returns:
- the MIME type.
- Since:
- 5.4
-