Top Description Methods
org.dom4j

public Interface Document

extends Branch
Known Direct Implementers
org.dom4j.tree.AbstractDocument
Annotations
@SuppressWarnings:unused
Imports
org.xml.sax.EntityResolver, java.util.Map

Document defines an XML Document.
Author
James Strachan
Version
$Revision: 1.14 $

Method Summary

Modifier and TypeMethod and Description
public Document

Returns:

this Document instance.
addComment
(String
is the text for the Comment node.
comment
)

Adds a new Comment node with the given text to this branch.

public Document

Returns:

this Document instance.
addDocType
(String
is the name of the root element
name
,
String
is the PUBLIC URI
publicId
,
String
is the SYSTEM URI
systemId
)

Adds a DOCTYPE declaration to this document

public Document

Returns:

this Document instance.
addProcessingInstruction
(String
is the target of the processing instruction
target
,
String
is the textual data (key/value pairs) of the processing instruction
text
)

Adds a processing instruction for the given target

public Document

Returns:

this Document instance.
addProcessingInstruction
(String
is the target of the processing instruction
target
,
Map<String, String>
is a Map of the key / value pairs of the processing instruction
data
)

Adds a processing instruction for the given target

public DocumentType

Returns:

the DocumentType property
getDocType
()

DOCUMENT ME!

public EntityResolver

Returns:

the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents
getEntityResolver
()

DOCUMENT ME!

public Element

Returns:

the root element for this document
getRootElement
()

Returns the root Elementfor this document.

public String

Returns:

The encoding of this document, as stated in the XML declaration, or null if unknown.
getXMLEncoding
()

Return the encoding of this document, as part of the XML declaration This is null when 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.

public void
setDocType(DocumentType
DOCUMENT ME!
docType
)

Sets the DocumentType property

public void
setEntityResolver(EntityResolver
DOCUMENT ME!
entityResolver
)

Sets the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents

public void
setRootElement(Element
the new root element for this document
rootElement
)

Sets the root element for this document

public void
setXMLEncoding(String
the encoding of the document
encoding
)

Sets the encoding of this document as it will appear in the XML declaration part of the document.

Inherited from org.dom4j.Branch:
addaddaddaddaddElementaddElementaddElementappendContentclearContentcontentelementByIDindexOfnodenodeCountnodeIteratornormalizeprocessingInstructionprocessingInstructionsprocessingInstructionsremoveremoveremoveremoveremoveProcessingInstructionsetContentsetProcessingInstructions

Method Detail

addCommentback to summary
public Document addComment(String comment)

Adds a new Comment node with the given text to this branch.

Parameters
comment:String

is the text for the Comment node.

Returns:Document

this Document instance.

addDocTypeback to summary
public Document addDocType(String name, String publicId, String systemId)

Adds a DOCTYPE declaration to this document

Parameters
name:String

is the name of the root element

publicId:String

is the PUBLIC URI

systemId:String

is the SYSTEM URI

Returns:Document

this Document instance.

addProcessingInstructionback to summary
public Document addProcessingInstruction(String target, String text)

Adds a processing instruction for the given target

Parameters
target:String

is the target of the processing instruction

text:String

is the textual data (key/value pairs) of the processing instruction

Returns:Document

this Document instance.

addProcessingInstructionback to summary
public Document addProcessingInstruction(String target, Map<String, String> data)

Adds a processing instruction for the given target

Parameters
target:String

is the target of the processing instruction

data:Map<String, String>

is a Map of the key / value pairs of the processing instruction

Returns:Document

this Document instance.

getDocTypeback to summary
public DocumentType getDocType()

DOCUMENT ME!

Returns:DocumentType

the DocumentType property

getEntityResolverback to summary
public EntityResolver getEntityResolver()

DOCUMENT ME!

Returns:EntityResolver

the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents

getRootElementback to summary
public Element getRootElement()

Returns the root Elementfor this document.

Returns:Element

the root element for this document

getXMLEncodingback to summary
public String getXMLEncoding()

Return the encoding of this document, as part of the XML declaration This is null when 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 the org.xml.sax.ext.Locator2 interface, the result returned by this method is specified by the getEncoding() method of that interface.

Returns:String

The encoding of this document, as stated in the XML declaration, or null if unknown.

Since
1.5
setDocTypeback to summary
public void setDocType(DocumentType docType)

Sets the DocumentType property

Parameters
docType:DocumentType

DOCUMENT ME!

setEntityResolverback to summary
public void setEntityResolver(EntityResolver entityResolver)

Sets the EntityResolver used to find resolve URIs such as for DTDs, or XML Schema documents

Parameters
entityResolver:EntityResolver

DOCUMENT ME!

setRootElementback to summary
public void setRootElement(Element rootElement)

Sets the root element for this document

Parameters
rootElement:Element

the new root element for this document

setXMLEncodingback to summary
public void setXMLEncoding(String encoding)

Sets the encoding of this document as it will appear in the XML declaration part of the document.

Parameters
encoding:String

the encoding of the document

Since
1.6