public class DocumentImpl extends RootNode implements org.w3c.dom.Document, OMDocument, IContainer
| Modifier and Type | Field and Description |
|---|---|
protected OMXMLParserWrapper |
builder |
private java.lang.String |
charEncoding |
private DOMConfigurationImpl |
domConfig |
private java.util.Vector |
idAttrs |
protected java.util.Hashtable |
identifiers |
protected int |
state |
private java.lang.String |
xmlEncoding |
private boolean |
xmlStandalone |
private java.lang.String |
xmlVersion |
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(org.w3c.dom.Attr attr) |
org.w3c.dom.Node |
adoptNode(org.w3c.dom.Node node) |
void |
build()
Builds itself.
|
protected void |
checkQName(java.lang.String prefix,
java.lang.String local)
Borrowed from the Xerces impl.
|
org.w3c.dom.Attr |
createAttribute(java.lang.String name) |
org.w3c.dom.Attr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName) |
org.w3c.dom.CDATASection |
createCDATASection(java.lang.String data) |
protected DocumentImpl |
createClone(OMCloneOptions options) |
org.w3c.dom.Comment |
createComment(java.lang.String data) |
org.w3c.dom.DocumentFragment |
createDocumentFragment() |
org.w3c.dom.Element |
createElement(java.lang.String tagName) |
org.w3c.dom.Element |
createElementNS(java.lang.String ns,
java.lang.String qualifiedName) |
org.w3c.dom.EntityReference |
createEntityReference(java.lang.String name) |
org.w3c.dom.ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data) |
org.w3c.dom.Text |
createTextNode(java.lang.String value) |
void |
discarded() |
OMXMLParserWrapper |
getBuilder()
Returns the builder object.
|
java.lang.String |
getCharsetEncoding()
Get the character set encoding scheme.
|
org.w3c.dom.DocumentType |
getDoctype() |
org.w3c.dom.Element |
getDocumentElement()
Returns the document element.
|
java.lang.String |
getDocumentURI() |
org.w3c.dom.DOMConfiguration |
getDomConfig() |
org.w3c.dom.Element |
getElementById(java.lang.String elementId) |
org.w3c.dom.NodeList |
getElementsByTagName(java.lang.String tagname) |
org.w3c.dom.NodeList |
getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName) |
org.w3c.dom.DOMImplementation |
getImplementation() |
java.lang.String |
getInputEncoding() |
org.w3c.dom.Node |
getNextSibling() |
java.lang.String |
getNodeName() |
short |
getNodeType() |
OMElement |
getOMDocumentElement()
Get the document element.
|
(package private) OMElement |
getOMDocumentElement(boolean build) |
org.w3c.dom.Document |
getOwnerDocument() |
int |
getState() |
boolean |
getStrictErrorChecking() |
java.lang.String |
getTextContent() |
java.lang.String |
getXmlEncoding() |
java.lang.String |
getXMLEncoding()
Get the charset encoding of this document as specified in the XML declaration.
|
boolean |
getXmlStandalone() |
java.lang.String |
getXmlVersion() |
java.lang.String |
getXMLVersion()
Returns the XML version.
|
org.w3c.dom.Node |
importNode(org.w3c.dom.Node importedNode,
boolean deep) |
(package private) ParentNode |
internalGetOwnerNode()
Get the parent or the owner document of the node.
|
void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache) |
protected void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache,
boolean includeXMLDeclaration) |
(package private) void |
internalSetOwnerNode(ParentNode ownerNode) |
boolean |
isComplete()
Indicates whether parser has parsed this information item completely or not.
|
java.lang.String |
isStandalone()
XML standalone value.
|
java.lang.String |
lookupNamespaceURI(java.lang.String specifiedPrefix) |
void |
normalizeDocument() |
void |
removeChildren()
Remove all children from this container.
|
protected void |
removeIdAttr(org.w3c.dom.Attr attr) |
org.w3c.dom.Node |
renameNode(org.w3c.dom.Node node,
java.lang.String namespaceURI,
java.lang.String qualifiedName) |
void |
serialize(java.io.OutputStream output,
OMOutputFormat format)
Serialize the node with caching enabled.
|
void |
serializeAndConsume(java.io.OutputStream output,
OMOutputFormat format)
Serialize the node without caching.
|
void |
setCharsetEncoding(java.lang.String charsetEncoding)
Sets the character set encoding scheme to be used.
|
void |
setComplete(boolean complete) |
void |
setDocumentURI(java.lang.String documentURI) |
void |
setOMDocumentElement(OMElement documentElement)
Set the document element of the XML document.
|
void |
setStandalone(java.lang.String isStandalone) |
void |
setStrictErrorChecking(boolean strictErrorChecking) |
void |
setTextContent(java.lang.String textContent) |
void |
setXMLEncoding(java.lang.String encoding)
Set the charset encoding for the XML declaration of this document.
|
void |
setXmlStandalone(boolean standalone) |
void |
setXmlVersion(java.lang.String version) |
void |
setXMLVersion(java.lang.String version)
Sets the XML version.
|
(package private) ParentNode |
shallowClone(OMCloneOptions options,
ParentNode targetParent,
boolean namespaceRepairing) |
internalGetNextSibling, internalGetPreviousSibling, internalSetNextSibling, internalSetPreviousSiblingaddChild, addChild, appendChild, clone, getChildNodes, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getDescendants, getFirstChild, getFirstChildWithName, getFirstOMChild, getFirstOMChildIfAvailable, getLastChild, getLastKnownOMChild, getLength, getSAXSource, getTextContent, getXMLStreamReader, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, hasChildNodes, insertBefore, internalAppendChild, item, normalize, notifyChildComplete, removeChild, replaceChild, setFirstChild, setLastChildbuildWithAttachments, checkSameOwnerDocument, clone, cloneNode, close, compareDocumentPosition, detach, detach, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextOMSiblingIfAvailable, getNodeValue, getOMFactory, getParent, getParentNode, getPrefix, getPreviousOMSibling, getPreviousSibling, getUserData, hasAttributes, hasParent, hasParent, insertSiblingAfter, insertSiblingBefore, internalSerialize, internalSerializeAndConsume, isDefaultNamespace, isEqualNode, isFirstChild, isFirstChild, isSameNode, isSpecified, isSpecified, isSupported, lookupPrefix, normalize, ownerDocument, parentNode, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setNextOMSibling, setNodeValue, setOwnerDocument, 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
private java.lang.String xmlVersion
private java.lang.String xmlEncoding
private boolean xmlStandalone
private java.lang.String charEncoding
private java.util.Vector idAttrs
protected java.util.Hashtable identifiers
private final DOMConfigurationImpl domConfig
public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
public DocumentImpl(OMFactory factory)
ParentNode internalGetOwnerNode()
NodeImplNodeImpl.HAS_PARENT flag.internalGetOwnerNode in class NodeImplvoid internalSetOwnerNode(ParentNode ownerNode)
internalSetOwnerNode in class NodeImplpublic org.w3c.dom.Document getOwnerDocument()
getOwnerDocument in interface org.w3c.dom.NodegetOwnerDocument in class NodeImplpublic void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
throws javax.xml.stream.XMLStreamException
internalSerialize in class NodeImpljavax.xml.stream.XMLStreamExceptionpublic java.lang.String getNodeName()
getNodeName in interface org.w3c.dom.Nodepublic short getNodeType()
getNodeType in interface org.w3c.dom.Nodepublic org.w3c.dom.Attr createAttribute(java.lang.String name)
throws org.w3c.dom.DOMException
createAttribute in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
throws org.w3c.dom.DOMException
createAttributeNS in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
throws org.w3c.dom.DOMException
createCDATASection in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.Comment createComment(java.lang.String data)
createComment in interface org.w3c.dom.Documentpublic org.w3c.dom.DocumentFragment createDocumentFragment()
createDocumentFragment in interface org.w3c.dom.Documentpublic org.w3c.dom.Element createElement(java.lang.String tagName)
throws org.w3c.dom.DOMException
createElement in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.Element createElementNS(java.lang.String ns,
java.lang.String qualifiedName)
throws org.w3c.dom.DOMException
createElementNS in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
throws org.w3c.dom.DOMException
createEntityReference in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
java.lang.String data)
throws org.w3c.dom.DOMException
createProcessingInstruction in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic org.w3c.dom.Text createTextNode(java.lang.String value)
createTextNode in interface org.w3c.dom.Documentpublic org.w3c.dom.DocumentType getDoctype()
getDoctype in interface org.w3c.dom.Documentpublic org.w3c.dom.Element getElementById(java.lang.String elementId)
getElementById in interface org.w3c.dom.Documentpublic org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
getElementsByTagName in interface org.w3c.dom.Documentpublic org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI,
java.lang.String localName)
getElementsByTagNameNS in interface org.w3c.dom.Documentpublic org.w3c.dom.DOMImplementation getImplementation()
getImplementation in interface org.w3c.dom.Documentpublic org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
boolean deep)
throws org.w3c.dom.DOMException
importNode in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic java.lang.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 java.lang.String getXMLVersion()
OMDocumentgetXMLVersion in interface OMDocumentpublic java.lang.String isStandalone()
OMDocumentisStandalone in interface OMDocumentpublic void setCharsetEncoding(java.lang.String charsetEncoding)
OMDocumentsetCharsetEncoding in interface OMDocumentpublic void setOMDocumentElement(OMElement documentElement)
OMDocumentsetOMDocumentElement in interface OMDocumentdocumentElement - the new document element; must not be nullpublic void setStandalone(java.lang.String isStandalone)
setStandalone in interface OMDocumentpublic void serializeAndConsume(java.io.OutputStream output,
OMOutputFormat format)
throws javax.xml.stream.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 usejavax.xml.stream.XMLStreamExceptionpublic void serialize(java.io.OutputStream output,
OMOutputFormat format)
throws javax.xml.stream.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 usejavax.xml.stream.XMLStreamExceptionpublic void setXMLVersion(java.lang.String version)
OMDocumentsetXMLVersion in interface OMDocumentOMDocument.XML_10,
OMDocument.XML_11public java.lang.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(java.lang.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 OMElementOMElement getOMDocumentElement(boolean build)
public org.w3c.dom.Element getDocumentElement()
getDocumentElement in interface org.w3c.dom.DocumentDocument.getDocumentElement()protected final void checkQName(java.lang.String prefix,
java.lang.String local)
prefix - prefix of qualified namelocal - local part of qualified nameprotected void addIdAttr(org.w3c.dom.Attr attr)
protected void removeIdAttr(org.w3c.dom.Attr attr)
public java.lang.String getTextContent()
throws org.w3c.dom.DOMException
getTextContent in interface org.w3c.dom.NodegetTextContent in class ParentNodeorg.w3c.dom.DOMExceptionpublic void setTextContent(java.lang.String textContent)
throws org.w3c.dom.DOMException
setTextContent in interface org.w3c.dom.NodesetTextContent in class ParentNodeorg.w3c.dom.DOMExceptionpublic org.w3c.dom.Node adoptNode(org.w3c.dom.Node node)
throws org.w3c.dom.DOMException
adoptNode in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic java.lang.String getDocumentURI()
getDocumentURI in interface org.w3c.dom.Documentpublic org.w3c.dom.DOMConfiguration getDomConfig()
getDomConfig in interface org.w3c.dom.Documentpublic java.lang.String getInputEncoding()
getInputEncoding in interface org.w3c.dom.Documentpublic boolean getStrictErrorChecking()
getStrictErrorChecking in interface org.w3c.dom.Documentpublic java.lang.String getXmlEncoding()
getXmlEncoding in interface org.w3c.dom.Documentpublic boolean getXmlStandalone()
getXmlStandalone in interface org.w3c.dom.Documentpublic java.lang.String getXmlVersion()
getXmlVersion in interface org.w3c.dom.Documentpublic void normalizeDocument()
normalizeDocument in interface org.w3c.dom.Documentpublic org.w3c.dom.Node renameNode(org.w3c.dom.Node node,
java.lang.String namespaceURI,
java.lang.String qualifiedName)
throws org.w3c.dom.DOMException
renameNode in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic void setDocumentURI(java.lang.String documentURI)
setDocumentURI in interface org.w3c.dom.Documentpublic void setStrictErrorChecking(boolean strictErrorChecking)
setStrictErrorChecking in interface org.w3c.dom.Documentpublic void setXmlStandalone(boolean standalone)
throws org.w3c.dom.DOMException
setXmlStandalone in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionpublic void setXmlVersion(java.lang.String version)
throws org.w3c.dom.DOMException
setXmlVersion in interface org.w3c.dom.Documentorg.w3c.dom.DOMExceptionprotected void internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache,
boolean includeXMLDeclaration)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionParentNode shallowClone(OMCloneOptions options, ParentNode targetParent, boolean namespaceRepairing)
shallowClone in class ParentNodeprotected 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 OMSerializablebuild in class NodeImplpublic final org.w3c.dom.Node getNextSibling()
getNextSibling in interface org.w3c.dom.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 java.lang.String lookupNamespaceURI(java.lang.String specifiedPrefix)
lookupNamespaceURI in interface org.w3c.dom.Node