Package org.apache.tapestry5.dom
Class Document
-
- org.apache.tapestry5.dom.Node
-
- org.apache.tapestry5.dom.Document
-
-
Field Summary
Fields Modifier and Type Field Description static
XML_NAMESPACE_URI
XML Namespace URI.static
XMLNS_NAMESPACE_URI
Namespace used exclusively for defining namespaces.
-
Constructor Summary
Constructors Constructor Description Document()
Builds with an instance ofDefaultMarkupModel
.Document(MarkupModel model)
Same as Document(model, null).Document(MarkupModel model, encoding)
Same as Document(model, encoding, null).Document(MarkupModel model, encoding, mimeType)
Creates a document instance with a given markup model, encoding and MIME type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CData
content)
Adds and returns a new CDATA node.Document
text)
Adds the comment and returns this document for further construction.void
name, publicId, systemId)
Sets the DTD for the document, overriding any prior DTD.Element
path)
Finds an element based on a path of element names.Document
getDocument()
Element
id)
Tries to find an element in this document whose id is specified.MarkupModel
getMarkupModel()
getMimeType()
Returns the MIME type of this document.protected <,>
getNamespaceURIToPrefix()
Element
getRootElement()
boolean
hasDTD()
Returns true if the document has an explicit DTD (set viadtd(String, String, String)
).Element
name)
Creates the root element for this document, replacing any previous root element.Element
namespace, name)
Creates a new root element within a namespace.Document
text)
Adds the raw text and returns this document for further construction.Text
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.void
toMarkup(Document document, writer, <,> namespaceURIToPrefix)
-
Methods inherited from class org.apache.tapestry5.dom.Node
getContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, toString, wrap
-
-
-
-
Field Detail
-
XML_NAMESPACE_URI
public static final 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 XMLNS_NAMESPACE_URI
Namespace used exclusively for defining namespaces.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Document
public Document(MarkupModel model)
Same as Document(model, null).- Parameters:
model
- aMarkupModel
.
-
Document
public Document(MarkupModel model, encoding)
Same as Document(model, encoding, null).- Parameters:
model
- aMarkupModel
.
-
Document
public Document(MarkupModel model, encoding, mimeType)
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 Detail
-
getDocument
public Document getDocument()
- Overrides:
getDocument
in classNode
-
find
public 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 name)
Creates the root element for this document, replacing any previous root element.
-
newRootElement
public namespace, name)
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
-
getRootElement
public Element getRootElement()
-
getElementById
public 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 name, publicId, systemId)
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
public boolean hasDTD()
Returns true if the document has an explicit DTD (set viadtd(String, String, String)
).- Since:
- 5.3
-
getNamespaceURIToPrefix
protected <,> getNamespaceURIToPrefix()
- Overrides:
getNamespaceURIToPrefix
in classNode
-
comment
public text)
Adds the comment and returns this document for further construction.- Since:
- 5.1.0.0
-
raw
public text)
Adds the raw text and returns this document for further construction.- Since:
- 5.1.0.0
-
text
public 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
public content)
Adds and returns a new CDATA node.- Parameters:
content
- the content to be rendered by the node- Returns:
- the newly created node
-
getMimeType
public getMimeType()
Returns the MIME type of this document.- Returns:
- the MIME type.
- Since:
- 5.4
-
-