Package org.dom4j
Interface Document
- All Known Implementing Classes:
AbstractDocument,DefaultDocument,DOMDocument
Document defines an XML Document.- Version:
- $Revision: 1.14 $
- Author:
- James Strachan
-
Field Summary
Fields inherited from interface org.dom4j.Node
ANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE -
Method Summary
Modifier and TypeMethodDescriptionaddComment(String comment) Adds a newCommentnode with the given text to this branch.addDocType(String name, String publicId, String systemId) Adds a DOCTYPE declaration to this documentaddProcessingInstruction(String target, String text) Adds a processing instruction for the given targetaddProcessingInstruction(String target, Map<String, String> data) Adds a processing instruction for the given targetDOCUMENT ME!DOCUMENT ME!Returns the rootElementfor this document.Return the encoding of this document, as part of the XML declaration This isnullwhen unspecified or when it is not known (such as when the Document was created in memory) or when the implementation does not support this operation.voidsetDocType(DocumentType docType) Sets the DocumentType propertyvoidsetEntityResolver(EntityResolver entityResolver) Sets the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documentsvoidsetRootElement(Element rootElement) Sets the root element for this documentvoidsetXMLEncoding(String encoding) Sets the encoding of this document as it will appear in the XML declaration part of the document.Methods inherited from interface org.dom4j.Branch
add, add, add, add, addElement, addElement, addElement, appendContent, clearContent, content, elementByID, indexOf, node, nodeCount, nodeIterator, normalize, processingInstruction, processingInstructions, processingInstructions, remove, remove, remove, remove, removeProcessingInstruction, setContent, setProcessingInstructionsMethods inherited from interface org.dom4j.Node
accept, asXML, asXPathResult, clone, createXPath, detach, getDocument, getName, getNodeType, getNodeTypeName, getParent, getPath, getPath, getStringValue, getText, getUniquePath, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setName, setParent, setText, supportsParent, valueOf, write
-
Method Details
-
getRootElement
Element getRootElement()Returns the rootElementfor this document.- Returns:
- the root element for this document
-
setRootElement
Sets the root element for this document- Parameters:
rootElement- the new root element for this document
-
addComment
Adds a newCommentnode with the given text to this branch.- Parameters:
comment- is the text for theCommentnode.- Returns:
- this
Documentinstance.
-
addProcessingInstruction
Adds a processing instruction for the given target- Parameters:
target- is the target of the processing instructiontext- is the textual data (key/value pairs) of the processing instruction- Returns:
- this
Documentinstance.
-
addProcessingInstruction
Adds a processing instruction for the given target- Parameters:
target- is the target of the processing instructiondata- is a Map of the key / value pairs of the processing instruction- Returns:
- this
Documentinstance.
-
addDocType
Adds a DOCTYPE declaration to this document- Parameters:
name- is the name of the root elementpublicId- is the PUBLIC URIsystemId- is the SYSTEM URI- Returns:
- this
Documentinstance.
-
getDocType
DocumentType getDocType()DOCUMENT ME!- Returns:
- the DocumentType property
-
setDocType
Sets the DocumentType property- Parameters:
docType- DOCUMENT ME!
-
getEntityResolver
EntityResolver getEntityResolver()DOCUMENT ME!- Returns:
- the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents
-
setEntityResolver
Sets the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents- Parameters:
entityResolver- DOCUMENT ME!
-
getXMLEncoding
String getXMLEncoding()Return the encoding of this document, as part of the XML declaration This isnullwhen unspecified or when it is not known (such as when the Document was created in memory) or when the implementation does not support this operation. The way this encoding is retrieved also depends on the way the XML source is parsed. For instance, if the SAXReader is used and if the underlying XMLReader implementation support theorg.xml.sax.ext.Locator2interface, the result returned by this method is specified by thegetEncoding()method of that interface.- Returns:
- The encoding of this document, as stated in the XML declaration,
or
nullif unknown. - Since:
- 1.5
-
setXMLEncoding
Sets the encoding of this document as it will appear in the XML declaration part of the document.- Parameters:
encoding- the encoding of the document- Since:
- 1.6
-