Package org.apache.tapestry5.dom
Class Document
- java.lang.Object
- 
- org.apache.tapestry5.dom.Node
- 
- org.apache.tapestry5.dom.Document
 
 
- 
- 
Field SummaryFields Modifier and Type Field Description static java.lang.StringXML_NAMESPACE_URIXML Namespace URI.static java.lang.StringXMLNS_NAMESPACE_URINamespace used exclusively for defining namespaces.
 - 
Constructor SummaryConstructors Constructor Description Document()Builds with an instance ofDefaultMarkupModel.Document(MarkupModel model)Same as Document(model, null).Document(MarkupModel model, java.lang.String encoding)Same as Document(model, encoding, null).Document(MarkupModel model, java.lang.String encoding, java.lang.String mimeType)Creates a document instance with a given markup model, encoding and MIME type.
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description CDatacdata(java.lang.String content)Adds and returns a new CDATA node.Documentcomment(java.lang.String text)Adds the comment and returns this document for further construction.voiddtd(java.lang.String name, java.lang.String publicId, java.lang.String systemId)Sets the DTD for the document, overriding any prior DTD.Elementfind(java.lang.String path)Finds an element based on a path of element names.DocumentgetDocument()ElementgetElementById(java.lang.String id)Tries to find an element in this document whose id is specified.MarkupModelgetMarkupModel()java.lang.StringgetMimeType()Returns the MIME type of this document.protected java.util.Map<java.lang.String,java.lang.String>getNamespaceURIToPrefix()ElementgetRootElement()booleanhasDTD()Returns true if the document has an explicit DTD (set viadtd(String, String, String)).ElementnewRootElement(java.lang.String name)Creates the root element for this document, replacing any previous root element.ElementnewRootElement(java.lang.String namespace, java.lang.String name)Creates a new root element within a namespace.Documentraw(java.lang.String text)Adds the raw text and returns this document for further construction.Texttext(java.lang.String 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.voidtoMarkup(Document document, java.io.PrintWriter writer, java.util.Map<java.lang.String,java.lang.String> namespaceURIToPrefix)- 
Methods inherited from class org.apache.tapestry5.dom.NodegetContainer, moveAfter, moveBefore, moveToBottom, moveToTop, remove, toMarkup, toString, wrap
 
- 
 
- 
- 
- 
Field Detail- 
XML_NAMESPACE_URIpublic 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_URIpublic static final java.lang.String XMLNS_NAMESPACE_URI Namespace used exclusively for defining namespaces.- See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
Documentpublic Document(MarkupModel model) Same as Document(model, null).- Parameters:
- model- a- MarkupModel.
 
 - 
Documentpublic Document(MarkupModel model, java.lang.String encoding) Same as Document(model, encoding, null).- Parameters:
- model- a- MarkupModel.
 
 - 
Documentpublic Document(MarkupModel model, java.lang.String encoding, java.lang.String mimeType) Creates a document instance with a given markup model, encoding and MIME type.- Parameters:
- model- a- MarkupModel.
- encoding- the encoding.
- mimeType- the MIME type.
- Since:
- 5.4
 
 - 
Documentpublic Document() Builds with an instance ofDefaultMarkupModel.
 
- 
 - 
Method Detail- 
getDocumentpublic Document getDocument() - Overrides:
- getDocumentin class- Node
 
 - 
findpublic 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)
 
 - 
getMarkupModelpublic MarkupModel getMarkupModel() 
 - 
newRootElementpublic Element newRootElement(java.lang.String name) Creates the root element for this document, replacing any previous root element.
 - 
newRootElementpublic 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
 
 - 
toMarkuppublic void toMarkup(Document document, java.io.PrintWriter writer, java.util.Map<java.lang.String,java.lang.String> namespaceURIToPrefix) 
 - 
getRootElementpublic Element getRootElement() 
 - 
getElementByIdpublic 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.
 
 - 
dtdpublic 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
 
 - 
hasDTDpublic boolean hasDTD() Returns true if the document has an explicit DTD (set viadtd(String, String, String)).- Since:
- 5.3
 
 - 
getNamespaceURIToPrefixprotected java.util.Map<java.lang.String,java.lang.String> getNamespaceURIToPrefix() - Overrides:
- getNamespaceURIToPrefixin class- Node
 
 - 
commentpublic Document comment(java.lang.String text) Adds the comment and returns this document for further construction.- Since:
- 5.1.0.0
 
 - 
rawpublic Document raw(java.lang.String text) Adds the raw text and returns this document for further construction.- Since:
- 5.1.0.0
 
 - 
textpublic Text text(java.lang.String 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
 
 - 
cdatapublic 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
 
 - 
getMimeTypepublic java.lang.String getMimeType() Returns the MIME type of this document.- Returns:
- the MIME type.
- Since:
- 5.4
 
 
- 
 
-