All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----org.jdom.Document
Document defines behavior for an XML Document, modeled
in Java. Methods allow the user to the root element as well
as processing instructions and other document-level information.
Document's
{
-
docType
- The
{
Default, no-args constructor for implementations to use if needed.
This will create a new
This will create a new
This will create a new
This will create a new Document,
with the supplied {
Document(Element, DocType)
Document,
with the supplied {
Document(List)
Document,
with the supplied list of content, and no
{
Document(List, DocType)
Document,
with the supplied list of content, and the supplied
{
This will add a comment to the Document.
Adds the specified PI to the document.
This will return a deep clone of this Document.
This tests for equality of this Document to the supplied
Object.
This will return all content for the Document.
This will return the
This will return all content for the
This returns the first processing instruction for this
This will return the list of
This returns the processing instructions for this
This will return the root
This will return the
This returns the hash code for this
This removes the specified
This removes the specified
This will remove the first PI with the specified target.
Deprecated.
This will remove all PIs with the specified target.
Deprecated.
This will set all content for the
This will set the
This will set all content for the
This sets the PIs for this
This sets the root
This returns a {
getMixedContent()
Document.
Deprecated.
getProcessingInstruction(String)
Document located at the document level
(outside the root element) for the supplied target, or null if
no such processing instruction exists.
Deprecated.
getProcessingInstructions()
{
Deprecated.
getProcessingInstructions(String)
Document located at the document level
(outside the root element) which have the supplied target.
Deprecated.
getRootElement()
Element
for this Document
getSerializedForm()
Document in XML format,
usable in an XML document.
Deprecated.
hashCode()
Document.
removeContent(Comment)
Comment.
removeContent(ProcessingInstruction)
ProcessingInstruction.
removeProcessingInstruction(String)
removeProcessingInstructions(String)
setContent(List)
Document.
setDocType(DocType)
{
setMixedContent(List)
Document.
Deprecated.
setProcessingInstructions(List)
Document to those in the
ListDeprecated.
setRootElement(Element)
{
toString()
String representation of the
Document, suitable for debugging.
protected List content
Document's
{@link Comment}s,
{@link ProcessingInstruction}s and
the root {@link Element}
protected DocType docType
{@link DocType} declaration
protected Document()
Default, no-args constructor for implementations to use if needed.
public Document(Element rootElement,
DocType docType)
This will create a new Document,
with the supplied {@link Element}
as the root element and the supplied
{@link DocType} declaration.
Element for document root.
DocType declaration.
public Document(Element rootElement)
This will create a new Document,
with the supplied {@link Element}
as the root element, and no {@link DocType}
declaration.
Element for document root
public Document(List content,
DocType docType)
This will create a new Document,
with the supplied list of content, and the supplied
{@link DocType} declaration.
List of starter content
DocType declaration.
public Document(List content)
This will create a new Document,
with the supplied list of content, and no
{@link DocType} declaration.
List of starter content
public Element getRootElement()
This will return the root Element
for this Document
Element - the document's root element
public Document setRootElement(Element rootElement)
This sets the root {@link Element} for the
Document.
Element to be new root.
Document - modified Document.
public DocType getDocType()
This will return the {@link DocType}
declaration for this Document, or
null if none exists.
DocType - the DOCTYPE declaration.
public Document setDocType(DocType docType)
This will set the {@link DocType}
declaration for this Document. Note
that a DocType can only be attached to one Document.
Attempting to set the DocType to a DocType object
that already belongs to a Document will result in an
IllegalAddException being thrown.
DocType declaration.
public Document addContent(ProcessingInstruction pi)
Adds the specified PI to the document.
Document this document modified.
public Document addContent(Comment comment)
This will add a comment to the Document.
Comment to add.
Document - this object modified.
public List getContent()
This will return all content for the Document.
The returned list is "live" in document order and changes to it
affect the document's actual content.
List - all Document content
public Document setContent(List newContent)
This will set all content for the Document.
The List may contain only objects of type Element, Comment, and
ProcessingInstruction; and only one Element that becomes the root.
In event of an exception the original content will be unchanged
and the items in the added content will be unaltered.
public String toString()
This returns a String representation of the
Document, suitable for debugging. If the XML
representation of the Document is desired,
{@link org.jdom.output.XMLOutputter#outputString(Document)}
should be used.
String - information about the
Document
public final boolean equals(Object ob)
This tests for equality of this Document to the supplied
Object.
Object to compare to.
boolean - whether the Document is
equal to the supplied Object.
public final int hashCode()
This returns the hash code for this Document.
int - hash code.
public Object clone()
This will return a deep clone of this Document.
Object - clone of this Document.
public boolean removeContent(ProcessingInstruction pi)
This removes the specified ProcessingInstruction.
If the specified ProcessingInstruction is not a child of
this Document, this method does nothing.
ProcessingInstruction to delete
public boolean removeContent(Comment comment)
This removes the specified Comment.
If the specified Comment is not a child of
this Document, this method does nothing.
Comment to delete
public final String getSerializedForm()
This will return the Document in XML format,
usable in an XML document.
String - the serialized form of the
Document.
public List getProcessingInstructions()
This will return the list of
{@link ProcessingInstruction}s
for this Document located at the document level
(outside the root element).
The returned list is "live" in document order and changes to it
affect the document's actual content.
List - PIs for document.
public List getProcessingInstructions(String target)
This returns the processing instructions for this
Document located at the document level
(outside the root element) which have the supplied target.
The returned list is "live" in document order and changes to it
affect the document's actual content.
String target of PI to return.
List - all PIs with the specified
target.
public ProcessingInstruction getProcessingInstruction(String target)
This returns the first processing instruction for this
Document located at the document level
(outside the root element) for the supplied target, or null if
no such processing instruction exists.
String target of PI to return.
ProcessingInstruction - the first PI
with the specified target, or null if no such PI exists.
public boolean removeProcessingInstruction(String target)
This will remove the first PI with the specified target.
String target of PI to remove.
boolean - whether the requested PI was removed.
public boolean removeProcessingInstructions(String target)
This will remove all PIs with the specified target.
String target of PI to remove.
boolean - whether the requested PIs were removed.
public Document setProcessingInstructions(List pis)
This sets the PIs for this Document to those in the
List
List of PIs to use.
Document - this Document modified.
public List getMixedContent()
This will return all content for the Document.
The returned list is "live" in document order and changes to it
affect the document's actual content.
List - all Document content
public Document setMixedContent(List mixedContent)
This will set all content for the Document.
The List may contain only objects of type Element, Comment, and
ProcessingInstruction; and only one Element that becomes the root.
In event of an exception the original content will be unchanged
and the items in the added content will be unaltered.
All Packages Class Hierarchy This Package Previous Next Index