| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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.
Constructor Summary | |
Document(Element rootElement, DocType docType) This will create a new Document ,
with the supplied Element
as the root element and the supplied
DocType declaration. | |
Document(Element rootElement) This will create a new Document ,
with the supplied Element
as the root element, and no DocType
declaration. |
Method Summary | |
Document | addContent(ProcessingInstruction pi) Adds the specified PI to the document. |
Document | addContent(Comment comment) This will add a comment to the Document . |
Object | clone() This will return a deep clone of this Document . |
final boolean | equals(Object ob) This tests for equality of this Document to the supplied
Object . |
DocType | getDocType() This will return the DocType
declaration for this Document , or
null if none exists. |
List | getMixedContent() This will return all content for the Document . |
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. |
List | getProcessingInstructions() This will return the list of ProcessingInstruction s
for this Document located at the document level
(outside the root element). |
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. |
Element | getRootElement() This will return the root Element
for this Document , or return null in the case the
root element hasn't been yet set. |
final String | getSerializedForm() This will return the Document in XML format,
usable in an XML document. |
final int | hashCode() This returns the hash code for this Document . |
boolean | removeContent(ProcessingInstruction pi) This removes the specified ProcessingInstruction . |
boolean | removeContent(Comment comment) This removes the specified Comment . |
boolean | removeProcessingInstruction(String target) This will remove the first PI with the specified target. |
boolean | removeProcessingInstructions(String target) This will remove all PIs with the specified target. |
Document | setDocType(DocType docType) This will set the DocType
declaration for this Document . |
Document | setMixedContent(List content) This will set all content for the Document . |
Document | setProcessingInstructions(List pis) This sets the PIs for this Document to those in the
List |
Document | setRootElement(Element rootElement) This sets the root Element for the
Document . |
String | toString() This returns a String representation of the
Document , suitable for debugging. |
Constructor Detail |
public Document(Element rootElement, DocType docType)
This will create a new Document
,
with the supplied Element
as the root element and the supplied
DocType
declaration.
Element
for document root.DocType
declaration.public Document(Element rootElement)
This will create a new Document
,
with the supplied Element
as the root element, and no DocType
declaration.
Element
for document rootMethod Detail |
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 Object clone()
This will return a deep clone of this Document
.
Object
- clone of this 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 DocType getDocType()
This will return the DocType
declaration for this Document
, or
null
if none exists.
DocType
- the DOCTYPE declaration.public List getMixedContent()
This will return all content for the Document
.
The returned list is "live" and changes to it affect the
document's actual content.
List
- all Document contentpublic 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 List getProcessingInstructions()
This will return the list of
ProcessingInstruction
s
for this Document
located at the document level
(outside the root element).
The returned list is "live" 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" and changes to it affect the
document's actual content.
String
target of PI to return.List
- all PIs with the specified
target.public Element getRootElement()
This will return the root Element
for this Document
, or return null in the case the
root element hasn't been yet set.
Element
- the document's root element, or
null if none has been yet setpublic final String getSerializedForm()
This will return the Document
in XML format,
usable in an XML document.
String
- the serialized form of the
Document
.public final int hashCode()
This returns the hash code for this Document
.
int
- hash code.public boolean removeContent(ProcessingInstruction pi)
This removes the specified ProcessingInstruction
.
ProcessingInstruction
to deletepublic boolean removeContent(Comment comment)
This removes the specified Comment
.
Comment
to deletepublic 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 setDocType(DocType docType)
This will set the DocType
declaration for this Document
.
DocType
declaration.public Document setMixedContent(List content)
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.
IllegalAddException
- if the List contains more than
one Element or objects of illegal typespublic 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 Document setRootElement(Element rootElement)
This sets the root Element
for the
Document
.
Element
to be new root.Document
- modified Document.public String toString()
This returns a String
representation of the
Document
, suitable for debugging. If the XML
representation of the Comment
is desired,
getSerializedForm()
should be used.
String
- information about the
Document
Association Links |
Document
's
{@link Comment}
s,
{@link ProcessingInstruction}
s and
the root {@link Element}
to Class org.jdom.Element
{@link Element}
of the Document
.to Class org.jdom.DocType
{@link DocType}
declaration
| |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |