public class DefaultDocument extends AbstractDocument
DefaultDocument is the default DOM4J default implementation of
an XML document.
encodingDEFAULT_CONTENT_LIST_SIZENODE_TYPE_NAMESANY_NODE, ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_REFERENCE_NODE, MAX_NODE_TYPE, NAMESPACE_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE, UNKNOWN_NODE| Constructor and Description |
|---|
DefaultDocument() |
DefaultDocument(DocumentType docType) |
DefaultDocument(Element rootElement) |
DefaultDocument(Element rootElement,
DocumentType docType) |
DefaultDocument(java.lang.String name) |
DefaultDocument(java.lang.String name,
Element rootElement,
DocumentType docType) |
| Modifier and Type | Method and Description |
|---|---|
Document |
addDocType(java.lang.String docTypeName,
java.lang.String publicId,
java.lang.String systemId)
Adds a DOCTYPE declaration to this document
|
protected void |
addNode(int index,
Node node) |
protected void |
addNode(Node node) |
void |
clearContent()
Clears the content for this branch, removing any
Node
instances this branch may contain. |
java.lang.Object |
clone()
clone will return a deep clone or if this node is
read-only then clone will return the same instance. |
protected java.util.List<Node> |
contentList()
DOCUMENT ME!
|
DocumentType |
getDocType()
DOCUMENT ME!
|
protected DocumentFactory |
getDocumentFactory() |
org.xml.sax.EntityResolver |
getEntityResolver()
DOCUMENT ME!
|
java.lang.String |
getName()
getName returns the name of this node. |
Element |
getRootElement()
Returns the root
Elementfor this document. |
java.lang.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. |
ProcessingInstruction |
processingInstruction(java.lang.String target)
DOCUMENT ME!
|
java.util.List<ProcessingInstruction> |
processingInstructions()
Returns a list of all the processing instructions in this branch.
|
java.util.List<ProcessingInstruction> |
processingInstructions(java.lang.String target)
Returns a list of the processing instructions for the given target.
|
protected boolean |
removeNode(Node node) |
boolean |
removeProcessingInstruction(java.lang.String target)
Removes the processing instruction for the given target if it exists
|
protected void |
rootElementAdded(Element element)
Called to set the root element variable
|
void |
setContent(java.util.List<Node> content)
Sets the contents of this branch as a
List of
Node instances. |
void |
setDocType(DocumentType docType)
Sets the DocumentType property
|
void |
setDocumentFactory(DocumentFactory documentFactory) |
void |
setEntityResolver(org.xml.sax.EntityResolver entityResolver)
Sets the EntityResolver used to find resolve URIs such as for DTDs, or
XML Schema documents
|
void |
setName(java.lang.String name)
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only. |
accept, add, addComment, addElement, addElement, addElement, addProcessingInstruction, addProcessingInstruction, asXML, asXPathResult, getDocument, getNodeType, getPath, getStringValue, getUniquePath, checkAddElementAllowed, childAdded, childRemoved, normalize, remove, setRootElement, setXMLEncoding, toString, writeadd, add, add, addElement, appendContent, content, contentRemoved, createContentList, createContentList, createEmptyList, createResultList, createSingleResultList, elementByID, elementID, getContentAsStringValue, getContentAsText, getText, getTextTrim, hasContent, indexOf, invalidNodeTypeAddException, isReadOnly, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructionscreatePattern, createXPath, createXPathFilter, createXPathResult, detach, getNodeTypeName, getParent, getPath, getUniquePath, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, setText, supportsParent, valueOfequals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, add, add, appendContent, content, elementByID, indexOf, node, nodeCount, nodeIterator, remove, remove, remove, setProcessingInstructionscreateXPath, detach, getNodeTypeName, getParent, getPath, getText, getUniquePath, hasContent, isReadOnly, matches, numberValueOf, selectNodes, selectNodes, selectNodes, selectObject, selectSingleNode, setDocument, setParent, setText, supportsParent, valueOfpublic DefaultDocument()
public DefaultDocument(java.lang.String name)
public DefaultDocument(Element rootElement)
public DefaultDocument(DocumentType docType)
public DefaultDocument(Element rootElement, DocumentType docType)
public DefaultDocument(java.lang.String name,
Element rootElement,
DocumentType docType)
public java.lang.String getName()
Node
getName returns the name of this node. This is the XML
local name of the element, attribute, entity or processing instruction.
For CDATA and Text nodes this method will return null.
getName in interface NodegetName in class AbstractNodepublic void setName(java.lang.String name)
Node
Sets the text data of this node or this method will throw an
UnsupportedOperationException if it is read-only.
setName in interface NodesetName in class AbstractNodename - is the new name of this nodepublic Element getRootElement()
DocumentElementfor this document.public DocumentType getDocType()
Documentpublic void setDocType(DocumentType docType)
DocumentdocType - DOCUMENT ME!public Document addDocType(java.lang.String docTypeName, java.lang.String publicId, java.lang.String systemId)
DocumentdocTypeName - is the name of the root elementpublicId - is the PUBLIC URIsystemId - is the SYSTEM URIDocument instance.public java.lang.String getXMLEncoding()
Documentnull 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.getXMLEncoding in interface DocumentgetXMLEncoding in class AbstractDocumentnull if unknown.public org.xml.sax.EntityResolver getEntityResolver()
Documentpublic void setEntityResolver(org.xml.sax.EntityResolver entityResolver)
DocumententityResolver - DOCUMENT ME!public java.lang.Object clone()
Node
clone will return a deep clone or if this node is
read-only then clone will return the same instance.
clone in interface Nodeclone in class AbstractNodepublic java.util.List<ProcessingInstruction> processingInstructions()
Branchpublic java.util.List<ProcessingInstruction> processingInstructions(java.lang.String target)
Branchtarget - DOCUMENT ME!public ProcessingInstruction processingInstruction(java.lang.String target)
Branchtarget - DOCUMENT ME!public boolean removeProcessingInstruction(java.lang.String target)
Branchtarget - DOCUMENT ME!public void setContent(java.util.List<Node> content)
BranchList of
Node instances.content - is the list of nodes to use as the content for this branch.public void clearContent()
BranchNode
instances this branch may contain.public void setDocumentFactory(DocumentFactory documentFactory)
protected java.util.List<Node> contentList()
AbstractBranchcontentList in class AbstractBranchprotected void addNode(Node node)
addNode in class AbstractBranchprotected void addNode(int index,
Node node)
addNode in class AbstractBranchprotected boolean removeNode(Node node)
removeNode in class AbstractBranchprotected void rootElementAdded(Element element)
AbstractDocumentrootElementAdded in class AbstractDocumentelement - DOCUMENT ME!protected DocumentFactory getDocumentFactory()
getDocumentFactory in class AbstractNode