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, lastChild
factory, FIRSTCHILD, flags, HAS_PARENT, SPECIFIED
ATTRIBUTE_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_NODE
XML_10, XML_11
COMPLETE, 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, setLastChild
buildWithAttachments, 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, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendChild, 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, setUserData
getLastKnownOMChild, setFirstChild, setLastChild
addChild
addChild, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getDescendants, getFirstChildWithName, getFirstOMChild, getSAXSource, getXMLStreamReader, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume
close, serialize, serialize, serializeAndConsume
clone, getOMFactory
getFirstOMChildIfAvailable
protected OMXMLParserWrapper builder
protected int state
protected Hashtable identifiers
public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
public DocumentImpl(OMFactory factory)
public Document getOwnerDocument()
getOwnerDocument
in interface Node
getOwnerDocument
in class NodeImpl
public void internalSerialize(XMLStreamWriter writer, boolean cache) throws XMLStreamException
internalSerialize
in class NodeImpl
XMLStreamException
public String getNodeName()
getNodeName
in interface Node
public short getNodeType()
getNodeType
in interface Node
public Attr createAttribute(String name) throws DOMException
createAttribute
in interface Document
DOMException
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
createAttributeNS
in interface Document
DOMException
public CDATASection createCDATASection(String data) throws DOMException
createCDATASection
in interface Document
DOMException
public Comment createComment(String data)
createComment
in interface Document
public DocumentFragment createDocumentFragment()
createDocumentFragment
in interface Document
public Element createElement(String tagName) throws DOMException
createElement
in interface Document
DOMException
public Element createElementNS(String ns, String qualifiedName) throws DOMException
createElementNS
in interface Document
DOMException
public EntityReference createEntityReference(String name) throws DOMException
createEntityReference
in interface Document
DOMException
public ProcessingInstruction createProcessingInstruction(String target, String data) throws DOMException
createProcessingInstruction
in interface Document
DOMException
public Text createTextNode(String value)
createTextNode
in interface Document
public DocumentType getDoctype()
getDoctype
in interface Document
public Element getElementById(String elementId)
getElementById
in interface Document
public NodeList getElementsByTagName(String tagname)
getElementsByTagName
in interface Document
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
getElementsByTagNameNS
in interface Document
public DOMImplementation getImplementation()
getImplementation
in interface Document
public Node importNode(Node importedNode, boolean deep) throws DOMException
importNode
in interface Document
DOMException
public String getCharsetEncoding()
OMDocument
null
when it is not known, such as
when the document was created in memory or from a character stream.getCharsetEncoding
in interface OMDocument
null
if the encoding is not
knownpublic String getXMLVersion()
OMDocument
getXMLVersion
in interface OMDocument
public String isStandalone()
OMDocument
isStandalone
in interface OMDocument
public void setCharsetEncoding(String charsetEncoding)
OMDocument
setCharsetEncoding
in interface OMDocument
public void setOMDocumentElement(OMElement documentElement)
OMDocument
setOMDocumentElement
in interface OMDocument
documentElement
- the new document element; must not be null
public void setStandalone(String isStandalone)
setStandalone
in interface OMDocument
public 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 OMContainer
serializeAndConsume
in class NodeImpl
output
- the byte stream to write the serialized infoset toformat
- the output format to useXMLStreamException
public 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 OMContainer
serialize
in class NodeImpl
output
- the byte stream to write the serialized infoset toformat
- the output format to useXMLStreamException
public void setXMLVersion(String version)
OMDocument
setXMLVersion
in interface OMDocument
OMDocument.XML_10
,
OMDocument.XML_11
public String getXMLEncoding()
OMDocument
getXMLEncoding
in interface OMDocument
null
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)
OMDocument
setXMLEncoding
in interface OMDocument
encoding
- the value of the encoding
attribute of the XML declarationpublic OMElement getOMDocumentElement()
OMDocument
getOMDocumentElement
in interface OMDocument
null
if the document doesn't have any children
of type OMElement
public Element getDocumentElement()
getDocumentElement
in interface Document
Document.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 Node
getTextContent
in class ParentNode
DOMException
public void setTextContent(String textContent) throws DOMException
setTextContent
in interface Node
setTextContent
in class ParentNode
DOMException
public Node adoptNode(Node node) throws DOMException
adoptNode
in interface Document
DOMException
public String getDocumentURI()
getDocumentURI
in interface Document
public DOMConfiguration getDomConfig()
getDomConfig
in interface Document
public String getInputEncoding()
getInputEncoding
in interface Document
public boolean getStrictErrorChecking()
getStrictErrorChecking
in interface Document
public String getXmlEncoding()
getXmlEncoding
in interface Document
public boolean getXmlStandalone()
getXmlStandalone
in interface Document
public String getXmlVersion()
getXmlVersion
in interface Document
public void normalizeDocument()
normalizeDocument
in interface Document
public Node renameNode(Node node, String namespaceURI, String qualifiedName) throws DOMException
renameNode
in interface Document
DOMException
public void setDocumentURI(String documentURI)
setDocumentURI
in interface Document
public void setStrictErrorChecking(boolean strictErrorChecking)
setStrictErrorChecking
in interface Document
public void setXmlStandalone(boolean standalone) throws DOMException
setXmlStandalone
in interface Document
DOMException
public void setXmlVersion(String version) throws DOMException
setXmlVersion
in interface Document
DOMException
protected void internalSerialize(XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws XMLStreamException
XMLStreamException
protected DocumentImpl createClone(OMCloneOptions options)
public final OMXMLParserWrapper getBuilder()
OMContainer
getBuilder
in interface IParentNode
getBuilder
in interface OMContainer
getBuilder
in class NodeImpl
public final int getState()
getState
in interface IParentNode
public final boolean isComplete()
OMSerializable
isComplete
in interface IParentNode
isComplete
in interface OMSerializable
isComplete
in class NodeImpl
public final void setComplete(boolean complete)
setComplete
in interface OMContainerEx
setComplete
in class NodeImpl
public final void discarded()
discarded
in interface OMContainerEx
public final void build()
OMSerializable
build
in interface OMSerializable
public final Node getNextSibling()
getNextSibling
in interface Node
public 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 OMContainer
public final String lookupNamespaceURI(String specifiedPrefix)
lookupNamespaceURI
in interface Node
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.