DocType and other document-level information.
| Modifier and Type | Field and Description |
|---|---|
| protected String | baseURI
See http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html#baseURIs-Considerations |
| pack-priv transient ContentList | content
This document's content including comments, PIs, a possible DocType, and a root element. |
| private transient HashMap | |
| private static final long | serialVersionUID
JDOM2 Serialization. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | |
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| public Document | Returns: the document on which the method was calledchild to append to end of content list child)Implements org. |
| public Document | Returns: the document on which the method was calledcollection to append c)Implements org. |
| public Document | Returns: the parent on which the method was calledlocation for adding the collection index, Content child to insert child)Implements org. |
| public Document | Returns: the parent on which the method was calledlocation for adding the collection index, Collection<? extends Content> collection to insert c)Implements org. |
| public void | canContainContent(Content
The content to be checked child, int The location where the content would be put. index, boolean true if the intention is to replace the content already at
the index. replace)Implements org. |
| public Document | Returns: Object clone of this DocumentOverrides org. Implements org. Document.
|
| public List | cloneContent()
Implements org. |
| public Element | |
| public final boolean | Returns: boolean whether the Document is
equal to the supplied ObjectObject to compare toOverrides java. Document to the supplied
Object.
|
| public final String | Returns: the base URI of this documentReturns the URI from which this document was loaded, or null if this is not known. |
| public Content | getContent(int
location of desired child index)Implements org. |
| public List | Returns: List - all Document contentImplements org. Document.
|
| public <F extends Content> List | Returns: List - filtered Document contentFilter to apply
Note that the Filters class has a number of predefined, useful
filters.Implements org. Document's content.
|
| public int | getContentSize()
Implements org. |
| public IteratorIterable | Returns: an iterator to walk descendantsImplements org. |
| public <F extends Content> IteratorIterable | Returns: an iterator to walk descendants within a filterfilter to select which descendants to see
Note that the filter)Filters class has a number of predefined, useful
filters.Implements org. |
| public DocType | Returns: DocType - the DOCTYPE declaration.This will return the |
| public Document | Returns: 'this' because this Document is its own DocumentImplements org. |
| public List | getNamespacesInherited()
Implements org. |
| public List | getNamespacesInScope()
Implements org. |
| public List | getNamespacesIntroduced()
Implements org. |
| public Parent | Returns: nullImplements org. |
| public Object | Returns: theObject associated with the given idthe id of the stored id)Object to returnReturns the object associated with this document under the given "id" string, or null if there is no binding or if the binding explicitly stored a null value. |
| public Element | Returns: Element - the document's root elementThis will return the root |
| public final int | Returns: int hash codeOverrides java. Document.
|
| public boolean | Returns: true if this document has a root element,
false otherwise.This will return |
| public int | indexOf(Content
child to search for child)Implements org. |
| private void | readObject(final ObjectInputStream
where to read the Element from. in)Read an Element off the ObjectInputStream. |
| public List | Returns: list of the old children detached from this parentImplements org. |
| public <F extends Content> List | Returns: list of the old children detached from this parentfilter to select which content to remove
Note that the filter)Filters class has a number of predefined, useful
filters.Implements org. |
| public boolean | removeContent(Content
child to remove child)Implements org. |
| public Content | removeContent(int
index of child to remove index)Implements org. |
| public final void | setBaseURI(String
the base URI of this document uri)Sets the effective URI from which this document was loaded, and against which relative URLs in this document will be resolved. |
| public Document | Returns: this document modifiedList of content to setThis sets the content of the |
| public Document | Returns: this document instance- index of child to replace. index, Content - child to add. child)Replace the current child the given index with the supplied child. |
| public Document | Returns: object on which the method was invoked- index of child to replace. index, Collection<? extends Content> - collection of content to add. collection)Replace the child at the given index with the supplied collection. |
| public Document | Returns: the parent on which the method was callednew content to replace existing content child)Set this document's content to be the supplied child. |
| public Document | Returns: object on which the method was invokedDocType declaration.This will set the |
| public void | setProperty(String
the id of the stored id, Object Objectthe value)Object to storeAssigns an arbitrary object to be associated with this document under the given "id" string. |
| public Document | Returns: Document - modified Document.Element to be new root.This sets the root |
| public String | Returns: String - information about the
DocumentOverrides java. String representation of the
Document, suitable for debugging.
|
| private void |
| baseURI | back to summary |
|---|---|
| protected String baseURI See http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/core.html#baseURIs-Considerations | |
| content | back to summary |
|---|---|
| pack-priv transient ContentList content This document's content including comments, PIs, a possible DocType, and a root element. Subclassers have to track content using their own mechanism. | |
| propertyMap | back to summary |
|---|---|
| private transient HashMap<String, Object> propertyMap | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID JDOM2 Serialization. In this case, DocType is simple. | |
| Document | back to summary |
|---|---|
| public Document() Creates a new empty document. A document must have a root element, so this document will not be well-formed and accessor methods will throw an IllegalStateException if this document is accessed before a root element is added. This method is most useful for build tools. | |
| Document | back to summary |
|---|---|
| public Document(Element rootElement, DocType docType, String baseURI) This will create a new
| |
| Document | back to summary |
|---|---|
| public Document(Element rootElement, DocType docType) This will create a new
| |
| Document | back to summary |
|---|---|
| public Document(Element rootElement) This will create a new
| |
| Document | back to summary |
|---|---|
| public Document(List<? extends Content> content) This will create a new
| |
| addContent | back to summary |
|---|---|
| public Document addContent(Content child) Implements org. Appends the child to the end of the content list.
| |
| addContent | back to summary |
|---|---|
| public Document addContent(Collection<? extends Content> c) Implements org. Appends all children in the given collection to the end of the content list. In event of an exception during add the original content will be unchanged and the objects in the supplied collection will be unaltered.
| |
| addContent | back to summary |
|---|---|
| public Document addContent(int index, Content child) Implements org. Inserts the child into the content list at the given index.
| |
| addContent | back to summary |
|---|---|
| public Document addContent(int index, Collection<? extends Content> c) Implements org. Inserts the content in a collection into the content list at the given index. In event of an exception the original content will be unchanged and the objects in the supplied collection will be unaltered.
| |
| canContainContent | back to summary |
|---|---|
| public void canContainContent(Content child, int index, boolean replace) Implements org. Doc from org. Test whether this Parent instance can contain the specified content at the specified position. | |
| clone | back to summary |
|---|---|
| public Document clone() Overrides org. Implements org. This will return a deep clone of this | |
| cloneContent | back to summary |
|---|---|
| public List Implements org. Doc from org. Returns a list containing detached clones of this parent's content list. | |
| detachRootElement | back to summary |
|---|---|
| public Element detachRootElement() Detach the root
| |
| equals | back to summary |
|---|---|
| public final boolean equals(Object ob) Overrides java. This tests for equality of this | |
| getBaseURI | back to summary |
|---|---|
| public final String getBaseURI() Returns the URI from which this document was loaded, or null if this is not known.
| |
| getContent | back to summary |
|---|---|
| public Content getContent(int index) Implements org. Doc from org. Returns the child at the given index. | |
| getContent | back to summary |
|---|---|
| public List Implements org. This will return all content for the Sequential traversal through the List is best done with a Iterator since the underlying implement of List.size() may require walking the entire list.
| |
| getContent | back to summary |
|---|---|
| public <F extends Content> List Implements org. Return a filtered view of this Sequential traversal through the List is best done with a Iterator since the underlying implement of List.size() may require walking the entire list.
| |
| getContentSize | back to summary |
|---|---|
| public int getContentSize() Implements org. Doc from org. Returns the number of children in this parent's content list.
Children may be any
| |
| getDescendants | back to summary |
|---|---|
| public IteratorIterable Implements org. Returns an iterator that walks over all descendants in document order.
| |
| getDescendants | back to summary |
|---|---|
| public <F extends Content> IteratorIterable Implements org. Returns an iterator that walks over all descendants in document order applying the Filter to return only elements that match the filter rule. With filters you can match only Elements, only Comments, Elements or Comments, only Elements with a given name and/or prefix, and so on.
| |
| getDocType | back to summary |
|---|---|
| public DocType getDocType() This will return the
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Implements org. Always returns this Document Instance | |
| getNamespacesInherited | back to summary |
|---|---|
| public List Implements org. Doc from org. Obtain a list of all namespaces that are in scope for this content, but were not introduced by this content. The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesIntroduced() | |
| getNamespacesInScope | back to summary |
|---|---|
| public List Implements org. Doc from org. Get the Namespaces that are in-scope on this Document.
Document always has exactly two Namespaces in-scope:
These namespaces are always introduced by the Document, and thus they are
both returned by
Description copied from
Obtain a list of all namespaces that are in scope for the current content. The contents of this list will always be the combination of getNamespacesIntroduced() and getNamespacesInherited().
See | |
| getNamespacesIntroduced | back to summary |
|---|---|
| public List Implements org. Doc from org. Obtain a list of all namespaces that are introduced to the XML tree by this node. Only Elements and Attributes can introduce namespaces, so all other Content types will return an empty list. The contents of this list will always be a subset (but in the same order) of getNamespacesInScope(), and will never intersect getNamspacesInherited() | |
| getParent | back to summary |
|---|---|
| public Parent getParent() Implements org. Always returns null, Document cannot have a parent. | |
| getProperty | back to summary |
|---|---|
| public Object getProperty(String id) Returns the object associated with this document under the given "id" string, or null if there is no binding or if the binding explicitly stored a null value. | |
| getRootElement | back to summary |
|---|---|
| public Element getRootElement() This will return the root
| |
| hashCode | back to summary |
|---|---|
| public final int hashCode() Overrides java. This returns the hash code for this
| |
| hasRootElement | back to summary |
|---|---|
| public boolean hasRootElement() This will return
| |
| indexOf | back to summary |
|---|---|
| public int indexOf(Content child) Implements org. Doc from org. Returns the index of the supplied child in the content list, or -1 if not a child of this parent. | |
| readObject | back to summary |
|---|---|
| private void readObject(final ObjectInputStream in) throws IOException, ClassNotFoundException Read an Element off the ObjectInputStream.
| |
| removeContent | back to summary |
|---|---|
| public List Implements org. Removes all child content from this parent. | |
| removeContent | back to summary |
|---|---|
| public <F extends Content> List Implements org. Remove all child content from this parent matching the supplied filter.
| |
| removeContent | back to summary |
|---|---|
| public boolean removeContent(Content child) Implements org. Doc from org. Removes a single child node from the content list. | |
| removeContent | back to summary |
|---|---|
| public Content removeContent(int index) Implements org. Doc from org. Removes and returns the child at the given index, or returns null if there's no such child. | |
| setBaseURI | back to summary |
|---|---|
| public final void setBaseURI(String uri) Sets the effective URI from which this document was loaded, and against which relative URLs in this document will be resolved.
| |
| setContent | back to summary |
|---|---|
| public Document setContent(Collection<? extends Content> newContent) This sets the content of the
When all objects in the supplied List are legal and before the new
content is added, all objects in the old content will have their
parentage set to null (no parent) and the old content list will be
cleared. This has the effect that any active list (previously obtained
with a call to Passing a null or empty List clears the existing content. In event of an exception the original content will be unchanged and the objects in the supplied content will be unaltered.
| |
| setContent | back to summary |
|---|---|
| public Document setContent(int index, Content child) Replace the current child the given index with the supplied child. In event of an exception the original content will be unchanged and the supplied child will be unaltered.
| |
| setContent | back to summary |
|---|---|
| public Document setContent(int index, Collection<? extends Content> collection) Replace the child at the given index with the supplied collection. In event of an exception the original content will be unchanged and the content in the supplied collection will be unaltered.
| |
| setContent | back to summary |
|---|---|
| public Document setContent(Content child) Set this document's content to be the supplied child. If the supplied child is legal content for a Document and before it is added, all content in the current content list will be cleared and all current children will have their parentage set to null.
This has the effect that any active list (previously obtained with
a call to one of the Passing a null child clears the existing content. In event of an exception the original content will be unchanged and the supplied child will be unaltered.
| |
| setDocType | back to summary |
|---|---|
| public Document setDocType(DocType docType) This will set the
| |
| setProperty | back to summary |
|---|---|
| public void setProperty(String id, Object value) Assigns an arbitrary object to be associated with this document under the given "id" string. Null values are permitted. 'id' Strings beginning with "http://www.jdom.org/ are reserved for JDOM use. Properties set with this method will not be serialized with the rest of this Document, should serialization need to be done. | |
| setRootElement | back to summary |
|---|---|
| public Document setRootElement(Element rootElement) This sets the root
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. This returns a | |
| writeObject | back to summary |
|---|---|
| private void writeObject(final ObjectOutputStream out) throws IOException Serialize out the Element.
| |