|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
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.
| Field Summary | |
protected java.util.List |
content
This Document's
s,
s and
the root |
protected DocType |
docType
The declaration |
protected Element |
rootElement
The root
of the Document. |
| Constructor Summary | |
protected |
Document()
Default, no-args constructor for implementations to use if needed. |
|
Document(Element rootElement)
This will create a new Document,
with the supplied
as the root element, and no
declaration. |
|
Document(Element rootElement,
DocType docType)
This will create a new Document,
with the supplied
as the root element and the supplied
declaration. |
| Method Summary | |
Document |
addComment(Comment c)
Deprecated. use addContent(Comment) instead |
Document |
addContent(Comment comment)
This will add a comment to the Document. |
Document |
addContent(Element element)
This will add an element to the Document. |
Document |
addContent(ProcessingInstruction pi)
Adds the specified PI to the document. |
Document |
addProcessingInstruction(ProcessingInstruction pi)
Deprecated. use addContent(ProcessingInstruction) instead |
Document |
addProcessingInstruction(java.lang.String target,
java.util.Map data)
Deprecated. use addContent(ProcessingInstruction) instead |
Document |
addProcessingInstruction(java.lang.String target,
java.lang.String data)
Deprecated. use addContent(ProcessingInstruction) instead |
java.lang.Object |
clone()
This will return a deep clone of this Document. |
boolean |
equals(java.lang.Object ob)
This tests for equality of this Document to the supplied
Object. |
DocType |
getDocType()
This will return the
declaration for this Document, or
null if none exists. |
java.util.List |
getMixedContent()
This will return all content for the Document. |
ProcessingInstruction |
getProcessingInstruction(java.lang.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. |
java.util.List |
getProcessingInstructions()
This will return the list of s
for this Document located at the document level
(outside the root element). |
java.util.List |
getProcessingInstructions(java.lang.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. |
java.lang.String |
getSerializedForm()
This will return the Document in XML format,
usable in an XML document. |
int |
hashCode()
This returns the hash code for this Document. |
boolean |
removeProcessingInstruction(ProcessingInstruction pi)
Deprecated. use doc.getMixedContent().remove(PI) instead |
boolean |
removeProcessingInstruction(java.lang.String target)
This will remove the first PI with the specified target. |
boolean |
removeProcessingInstructions(java.lang.String target)
This will remove all PIs with the specified target. |
Document |
setDocType(DocType docType)
This will set the
declaration for this Document. |
Document |
setMixedContent(java.util.List content)
This will set all content for the Document. |
Document |
setProcessingInstructions(java.util.List pis)
This sets the PIs for this Document to those in the
List
|
Document |
setRootElement(Element rootElement)
This sets the root for the
Document. |
java.lang.String |
toString()
This returns a String representation of the
Document, suitable for debugging. |
| Methods inherited from class java.lang.Object |
finalize,
getClass,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
protected java.util.List content
Document's
Comments,
ProcessingInstructions and
the root Elementprotected Element rootElement
Element
of the Document.protected DocType docType
DocType declaration| Constructor Detail |
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
as the root element and the supplied
Element declaration.
DocType
rootElement - Element for document root.docType - DocType declaration.public Document(Element rootElement)
This will create a new Document,
with the supplied
as the root element, and no Element
declaration.
DocType
rootElement - Element for document root| Method Detail |
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 Document setRootElement(Element rootElement)
This sets the root for the
ElementDocument.
rootElement - Element to be new root.Document - modified Document.public DocType getDocType()
This will return the
declaration for this DocTypeDocument, or
null if none exists.
DocType - the DOCTYPE declaration.public Document setDocType(DocType docType)
This will set the
declaration for this DocTypeDocument.
docType - DocType declaration.public java.util.List getProcessingInstructions()
This will return the list of
s
for this ProcessingInstructionDocument 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 java.util.List getProcessingInstructions(java.lang.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.
target - String target of PI to return.List - all PIs with the specified
target.public ProcessingInstruction getProcessingInstruction(java.lang.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.
target - String target of PI to return.ProcessingInstruction - the first PI
with the specified target, or null if no such PI exists.public boolean removeProcessingInstruction(java.lang.String target)
This will remove the first PI with the specified target.
target - String target of PI to remove.boolean - whether the requested PI was removed.public boolean removeProcessingInstructions(java.lang.String target)
This will remove all PIs with the specified target.
target - String target of PI to remove.boolean - whether the requested PIs were removed.public Document setProcessingInstructions(java.util.List pis)
This sets the PIs for this Document to those in the
List
pis - List of PIs to use.Document - this Document modified.public Document addContent(ProcessingInstruction pi)
Adds the specified PI to the document.
pi - the PI to add.Document this document modified.public Document addContent(Comment comment)
This will add a comment to the Document.
comment - Comment to add.Document - this object modified.public Document addContent(Element element)
This will add an element to the Document.
element - Element to add.Document - this object modified.public java.util.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 Document setMixedContent(java.util.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.
content - the new mixed contentIllegalAddException - if the List contains more than
one Element or objects of illegal typespublic final java.lang.String toString()
This returns a String representation of the
Document, suitable for debugging. If the XML
representation of the Comment is desired,
should be used.
getSerializedForm()
String - information about the
Documentpublic final java.lang.String getSerializedForm()
This will return the Document in XML format,
usable in an XML document.
String - the serialized form of the
Document.public final boolean equals(java.lang.Object ob)
This tests for equality of this Document to the supplied
Object.
ob - 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 final java.lang.Object clone()
This will return a deep clone of this Document.
Object - clone of this Document.public Document addComment(Comment c)
public Document addProcessingInstruction(ProcessingInstruction pi)
public Document addProcessingInstruction(java.lang.String target,
java.lang.String data)
public Document addProcessingInstruction(java.lang.String target,
java.util.Map data)
public boolean removeProcessingInstruction(ProcessingInstruction pi)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||