public class DocumentImpl extends RootNode implements Document, OMDocument, IContainer
| Modifier and Type | Field and Description |
|---|---|
protected OMXMLParserWrapper |
builder |
protected Hashtable |
identifiers |
protected int |
state |
firstChild, lastChildfactory, FIRSTCHILD, flags, HAS_PARENT, SPECIFIEDATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODEXML_10, XML_11COMPLETE, DISCARDED, INCOMPLETE| Constructor and Description |
|---|
DocumentImpl(OMFactory factory) |
DocumentImpl(OMXMLParserWrapper parserWrapper,
OMFactory factory) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addIdAttr(Attr attr) |
Node |
adoptNode(Node node) |
void |
build()
Builds itself.
|
protected void |
checkQName(String prefix,
String local)
Borrowed from the Xerces impl.
|
Attr |
createAttribute(String name) |
Attr |
createAttributeNS(String namespaceURI,
String qualifiedName) |
CDATASection |
createCDATASection(String data) |
protected DocumentImpl |
createClone(OMCloneOptions options) |
Comment |
createComment(String data) |
DocumentFragment |
createDocumentFragment() |
Element |
createElement(String tagName) |
Element |
createElementNS(String ns,
String qualifiedName) |
EntityReference |
createEntityReference(String name) |
ProcessingInstruction |
createProcessingInstruction(String target,
String data) |
Text |
createTextNode(String value) |
void |
discarded() |
OMXMLParserWrapper |
getBuilder()
Returns the builder object.
|
String |
getCharsetEncoding()
Get the character set encoding scheme.
|
DocumentType |
getDoctype() |
Element |
getDocumentElement()
Returns the document element.
|
String |
getDocumentURI() |
DOMConfiguration |
getDomConfig() |
Element |
getElementById(String elementId) |
NodeList |
getElementsByTagName(String tagname) |
NodeList |
getElementsByTagNameNS(String namespaceURI,
String localName) |
DOMImplementation |
getImplementation() |
String |
getInputEncoding() |
Node |
getNextSibling() |
String |
getNodeName() |
short |
getNodeType() |
OMElement |
getOMDocumentElement()
Get the document element.
|
Document |
getOwnerDocument() |
int |
getState() |
boolean |
getStrictErrorChecking() |
String |
getTextContent() |
String |
getXmlEncoding() |
String |
getXMLEncoding()
Get the charset encoding of this document as specified in the XML declaration.
|
boolean |
getXmlStandalone() |
String |
getXmlVersion() |
String |
getXMLVersion()
Returns the XML version.
|
Node |
importNode(Node importedNode,
boolean deep) |
void |
internalSerialize(XMLStreamWriter writer,
boolean cache) |
protected void |
internalSerialize(XMLStreamWriter writer,
boolean cache,
boolean includeXMLDeclaration) |
boolean |
isComplete()
Indicates whether parser has parsed this information item completely or not.
|
String |
isStandalone()
XML standalone value.
|
String |
lookupNamespaceURI(String specifiedPrefix) |
void |
normalizeDocument() |
void |
removeChildren()
Remove all children from this container.
|
protected void |
removeIdAttr(Attr attr) |
Node |
renameNode(Node node,
String namespaceURI,
String qualifiedName) |
void |
serialize(OutputStream output,
OMOutputFormat format)
Serialize the node with caching enabled.
|
void |
serializeAndConsume(OutputStream output,
OMOutputFormat format)
Serialize the node without caching.
|
void |
setCharsetEncoding(String charsetEncoding)
Sets the character set encoding scheme to be used.
|
void |
setComplete(boolean complete) |
void |
setDocumentURI(String documentURI) |
void |
setOMDocumentElement(OMElement documentElement)
Set the document element of the XML document.
|
void |
setStandalone(String isStandalone) |
void |
setStrictErrorChecking(boolean strictErrorChecking) |
void |
setTextContent(String textContent) |
void |
setXMLEncoding(String encoding)
Set the charset encoding for the XML declaration of this document.
|
void |
setXmlStandalone(boolean standalone) |
void |
setXmlVersion(String version) |
void |
setXMLVersion(String version)
Sets the XML version.
|
addChild, addChild, appendChild, getChildNodes, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getDescendants, getFirstChild, getFirstChildWithName, getFirstOMChild, getFirstOMChildIfAvailable, getLastChild, getLastKnownOMChild, getLength, getSAXSource, getXMLStreamReader, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, hasChildNodes, insertBefore, item, removeChild, replaceChild, setFirstChild, setLastChildbuildWithAttachments, clone, cloneNode, close, compareDocumentPosition, detach, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextOMSiblingIfAvailable, getNodeValue, getOMFactory, getParent, getParentNode, getPrefix, getPreviousOMSibling, getPreviousSibling, getUserData, hasAttributes, insertSiblingAfter, insertSiblingBefore, internalSerialize, internalSerializeAndConsume, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupPrefix, normalize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setNextOMSibling, setNodeValue, setParent, setParent, setPrefix, setPreviousOMSibling, setUserDataclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitappendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNodeValue, getParentNode, getPrefix, getPreviousSibling, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setUserDatagetLastKnownOMChild, setFirstChild, setLastChildaddChildaddChild, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getDescendants, getFirstChildWithName, getFirstOMChild, getSAXSource, getXMLStreamReader, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsumeclose, serialize, serialize, serializeAndConsumeclone, getOMFactorygetFirstOMChildIfAvailableprotected OMXMLParserWrapper builder
protected int state
protected Hashtable identifiers
public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
public DocumentImpl(OMFactory factory)
public Document getOwnerDocument()
getOwnerDocument in interface NodegetOwnerDocument in class NodeImplpublic void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException
internalSerialize in class NodeImplXMLStreamExceptionpublic String getNodeName()
getNodeName in interface Nodepublic short getNodeType()
getNodeType in interface Nodepublic Attr createAttribute(String name) throws DOMException
createAttribute in interface DocumentDOMExceptionpublic Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
createAttributeNS in interface DocumentDOMExceptionpublic CDATASection createCDATASection(String data) throws DOMException
createCDATASection in interface DocumentDOMExceptionpublic Comment createComment(String data)
createComment in interface Documentpublic DocumentFragment createDocumentFragment()
createDocumentFragment in interface Documentpublic Element createElement(String tagName) throws DOMException
createElement in interface DocumentDOMExceptionpublic Element createElementNS(String ns, String qualifiedName) throws DOMException
createElementNS in interface DocumentDOMExceptionpublic EntityReference createEntityReference(String name) throws DOMException
createEntityReference in interface DocumentDOMExceptionpublic ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
createProcessingInstruction in interface DocumentDOMExceptionpublic Text createTextNode(String value)
createTextNode in interface Documentpublic DocumentType getDoctype()
getDoctype in interface Documentpublic Element getElementById(String elementId)
getElementById in interface Documentpublic NodeList getElementsByTagName(String tagname)
getElementsByTagName in interface Documentpublic NodeList getElementsByTagNameNS(String namespaceURI, String localName)
getElementsByTagNameNS in interface Documentpublic DOMImplementation getImplementation()
getImplementation in interface Documentpublic Node importNode(Node importedNode, boolean deep) throws DOMException
importNode in interface DocumentDOMExceptionpublic String getCharsetEncoding()
OMDocumentnull when it is not known, such as
when the document was created in memory or from a character stream.getCharsetEncoding in interface OMDocumentnull if the encoding is not
knownpublic String getXMLVersion()
OMDocumentgetXMLVersion in interface OMDocumentpublic String isStandalone()
OMDocumentisStandalone in interface OMDocumentpublic void setCharsetEncoding(String charsetEncoding)
OMDocumentsetCharsetEncoding in interface OMDocumentpublic void setOMDocumentElement(OMElement documentElement)
OMDocumentsetOMDocumentElement in interface OMDocumentdocumentElement - the new document element; must not be nullpublic void setStandalone(String isStandalone)
setStandalone in interface OMDocumentpublic void serializeAndConsume(OutputStream output, OMOutputFormat format) throws XMLStreamException
OMContainer
The format of the output is controlled by the provided OMOutputFormat object. In
particular, OMOutputFormat.setDoOptimize(boolean) can be used to instruct this method
to produce an XOP/MTOM encoded MIME message.
serializeAndConsume in interface OMContainerserializeAndConsume in class NodeImploutput - the byte stream to write the serialized infoset toformat - the output format to useXMLStreamExceptionpublic void serialize(OutputStream output, OMOutputFormat format) throws XMLStreamException
OMContainer
The format of the output is controlled by the provided OMOutputFormat object. In
particular, OMOutputFormat.setDoOptimize(boolean) can be used to instruct this method
to produce an XOP/MTOM encoded MIME message.
serialize in interface OMContainerserialize in class NodeImploutput - the byte stream to write the serialized infoset toformat - the output format to useXMLStreamExceptionpublic void setXMLVersion(String version)
OMDocumentsetXMLVersion in interface OMDocumentOMDocument.XML_10,
OMDocument.XML_11public String getXMLEncoding()
OMDocumentgetXMLEncoding in interface OMDocumentnull if the
document didn't have an XML declaration or if the encoding attribute was
not specified in the XML declarationpublic void setXMLEncoding(String encoding)
OMDocumentsetXMLEncoding in interface OMDocumentencoding - the value of the encoding attribute of the XML declarationpublic OMElement getOMDocumentElement()
OMDocumentgetOMDocumentElement in interface OMDocumentnull if the document doesn't have any children
of type OMElementpublic Element getDocumentElement()
getDocumentElement in interface DocumentDocument.getDocumentElement()protected final void checkQName(String prefix, String local)
prefix - prefix of qualified namelocal - local part of qualified nameprotected void addIdAttr(Attr attr)
protected void removeIdAttr(Attr attr)
public String getTextContent() throws DOMException
getTextContent in interface NodegetTextContent in class ParentNodeDOMExceptionpublic void setTextContent(String textContent) throws DOMException
setTextContent in interface NodesetTextContent in class ParentNodeDOMExceptionpublic Node adoptNode(Node node) throws DOMException
adoptNode in interface DocumentDOMExceptionpublic String getDocumentURI()
getDocumentURI in interface Documentpublic DOMConfiguration getDomConfig()
getDomConfig in interface Documentpublic String getInputEncoding()
getInputEncoding in interface Documentpublic boolean getStrictErrorChecking()
getStrictErrorChecking in interface Documentpublic String getXmlEncoding()
getXmlEncoding in interface Documentpublic boolean getXmlStandalone()
getXmlStandalone in interface Documentpublic String getXmlVersion()
getXmlVersion in interface Documentpublic void normalizeDocument()
normalizeDocument in interface Documentpublic Node renameNode(Node node, String namespaceURI, String qualifiedName) throws DOMException
renameNode in interface DocumentDOMExceptionpublic void setDocumentURI(String documentURI)
setDocumentURI in interface Documentpublic void setStrictErrorChecking(boolean strictErrorChecking)
setStrictErrorChecking in interface Documentpublic void setXmlStandalone(boolean standalone)
throws DOMException
setXmlStandalone in interface DocumentDOMExceptionpublic void setXmlVersion(String version) throws DOMException
setXmlVersion in interface DocumentDOMExceptionprotected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException
XMLStreamExceptionprotected DocumentImpl createClone(OMCloneOptions options)
public final OMXMLParserWrapper getBuilder()
OMContainergetBuilder in interface IParentNodegetBuilder in interface OMContainergetBuilder in class NodeImplpublic final int getState()
getState in interface IParentNodepublic final boolean isComplete()
OMSerializableisComplete in interface IParentNodeisComplete in interface OMSerializableisComplete in class NodeImplpublic final void setComplete(boolean complete)
setComplete in interface OMContainerExsetComplete in class NodeImplpublic final void discarded()
discarded in interface OMContainerExpublic final void build()
OMSerializablebuild in interface OMSerializablepublic final Node getNextSibling()
getNextSibling in interface Nodepublic final void removeChildren()
OMContainer
for (Iterator it = container.getChildren(); it.hasNext(); ) {
it.next();
it.remove();
}
However, the implementation may do this in an optimized way. In particular, if the node is
incomplete, it may choose not to instantiate child node that would become unreachable anyway.removeChildren in interface OMContainerpublic final String lookupNamespaceURI(String specifiedPrefix)
lookupNamespaceURI in interface NodeCopyright © 2004–2024 The Apache Software Foundation. All rights reserved.