public class DocumentImpl extends ParentNode implements Document, OMDocument
Modifier and Type | Field and Description |
---|---|
protected ElementImpl |
documentElement |
protected Hashtable |
identifiers |
firstChild, lastChild
nextSibling, parentNode, previousSibling
builder, done, factory, FIRSTCHILD, flags, NORMALIZED, OWNED, ownerNode, READONLY, 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
DTD_NODE, PI_NODE, SPACE_NODE
Constructor and Description |
---|
DocumentImpl(DocumentImpl ownerDocument,
OMFactory factory) |
DocumentImpl(OMFactory factory) |
DocumentImpl(OMXMLParserWrapper parserWrapper,
OMFactory factory) |
Modifier and Type | Method and Description |
---|---|
protected void |
addIdAttr(Attr attr) |
Node |
adoptNode(Node node) |
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 arg0) |
Comment |
createComment(String data) |
DocumentFragment |
createDocumentFragment() |
Element |
createElement(String tagName) |
Element |
createElementNS(String ns,
String qualifiedName) |
EntityReference |
createEntityReference(String arg0) |
ProcessingInstruction |
createProcessingInstruction(String target,
String data) |
Text |
createTextNode(String value) |
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 arg0) |
NodeList |
getElementsByTagNameNS(String arg0,
String arg1) |
DOMImplementation |
getImplementation() |
String |
getInputEncoding() |
OMNode |
getNextOMSibling()
Default behavior returns null, overriden in ChildNode.
|
Node |
getNextSibling()
Returns the next child of this node's parent, or null if none.
|
String |
getNodeName() |
short |
getNodeType() |
OMElement |
getOMDocumentElement()
Returns the document element.
|
OMContainer |
getParent()
Returns the parent containing node.
|
OMNode |
getPreviousOMSibling()
Default behavior returns null, overriden in ChildNode.
|
Node |
getPreviousSibling()
Returns the previous child of this node's parent, or null if none.
|
boolean |
getStrictErrorChecking() |
String |
getTextContent() |
int |
getType()
Returns the type of node.
|
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(javax.xml.stream.XMLStreamWriter writer,
boolean cache)
Serializes the node.
|
protected void |
internalSerialize(javax.xml.stream.XMLStreamWriter writer,
boolean cache,
boolean includeXMLDeclaration) |
String |
isStandalone()
XML standalone value.
|
void |
normalizeDocument() |
protected void |
removeIdAttr(Attr attr) |
Node |
renameNode(Node arg0,
String arg1,
String arg2) |
void |
serialize(OutputStream output,
OMOutputFormat format)
Serializes the node with caching.
|
void |
serializeAndConsume(OutputStream output,
OMOutputFormat format)
Serializes the node without caching.
|
void |
setCharsetEncoding(String charsetEncoding)
Sets the character set encoding scheme to be used.
|
void |
setDocumentURI(String arg0) |
void |
setNextOMSibling(OMNode node) |
void |
setOMDocumentElement(OMElement rootElement)
Sets the document element of the XML document.
|
void |
setParent(OMContainer element) |
void |
setPreviousOMSibling(OMNode node) |
void |
setStandalone(String isStandalone) |
void |
setStrictErrorChecking(boolean arg0) |
void |
setTextContent(String textContent) |
void |
setType(int nodeType) |
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, buildNext, cloneNode, getBuilder, getChildNodes, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getFirstChild, getFirstChildWithName, getFirstOMChild, getFirstOMChildIfAvailable, getLastChild, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, hasChildNodes, importNode, insertBefore, removeChild, replaceChild, setFirstChild, setLastChild
detach, discard, getNextOMSiblingIfAvailable, getParentNode, insertSiblingAfter, insertSiblingBefore
appendChild, build, buildWithAttachments, close, compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLength, getLocalName, getNamespaceURI, getNodeValue, getOMFactory, getOwnerDocument, getPrefix, getUserData, hasAttributes, internalSerialize, internalSerializeAndConsume, isComplete, isDefaultNamespace, isEqualNode, isSameNode, isSupported, item, lookupNamespaceURI, lookupPrefix, normalize, serialize, serialize, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume, serializeAndConsume, setComplete, setNodeValue, setOwnerDocument, setPrefix, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setUserData
addChild, buildNext, getBuilder, getChildren, getChildrenWithLocalName, getChildrenWithName, getChildrenWithNamespaceURI, getFirstChildWithName, getFirstOMChild, getXMLStreamReader, getXMLStreamReader, getXMLStreamReaderWithoutCaching, serialize, serialize, serialize, serializeAndConsume, serializeAndConsume, serializeAndConsume
build, close, getOMFactory, isComplete, serialize, serialize, serializeAndConsume
setComplete
protected ElementImpl documentElement
protected Hashtable identifiers
public DocumentImpl(DocumentImpl ownerDocument, OMFactory factory)
ownerDocument
- public DocumentImpl(OMXMLParserWrapper parserWrapper, OMFactory factory)
public DocumentImpl(OMFactory factory)
public void setType(int nodeType) throws OMException
setType
in interface OMNodeEx
OMException
public int getType() throws OMException
OMNode
getType
in interface OMNode
OMNode.ELEMENT_NODE
, OMNode.TEXT_NODE
, OMNode.CDATA_SECTION_NODE
,
OMNode.COMMENT_NODE
, OMNode.DTD_NODE
, OMNode.PI_NODE
, OMNode.ENTITY_REFERENCE_NODE
or OMNode.SPACE_NODE
.OMException
public void internalSerialize(javax.xml.stream.XMLStreamWriter writer, boolean cache) throws javax.xml.stream.XMLStreamException
OMNodeEx
OMSerializable.serialize(XMLStreamWriter, boolean)
instead.internalSerialize
in interface OMNodeEx
cache
- indicates if caching should be enabledjavax.xml.stream.XMLStreamException
public OMNode getNextOMSibling() throws OMException
NodeImpl
getNextOMSibling
in interface OMNode
getNextOMSibling
in class ChildNode
OMException
public Node getNextSibling()
NodeImpl
getNextSibling
in interface Node
getNextSibling
in class ChildNode
public OMContainer getParent() throws OMException
OMNode
OMDocument
or OMElement
.getParent
in interface OMNode
getParent
in class ChildNode
OMContainer
of the node.OMException
public OMNode getPreviousOMSibling()
NodeImpl
getPreviousOMSibling
in interface OMNode
getPreviousOMSibling
in class ChildNode
public Node getPreviousSibling()
NodeImpl
getPreviousSibling
in interface Node
getPreviousSibling
in class ChildNode
public void setNextOMSibling(OMNode node)
setNextOMSibling
in interface OMNodeEx
setNextOMSibling
in class ChildNode
public void setParent(OMContainer element)
public void setPreviousOMSibling(OMNode node)
setPreviousOMSibling
in interface OMNodeEx
setPreviousOMSibling
in class ChildNode
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 arg0) 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 arg0) 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 arg0)
getElementsByTagName
in interface Document
public NodeList getElementsByTagNameNS(String arg0, String arg1)
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 rootElement)
OMDocument
setOMDocumentElement
in interface OMDocument
public void setStandalone(String isStandalone)
setStandalone
in interface OMDocument
public void serializeAndConsume(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMContainer
serializeAndConsume
in interface OMContainer
serializeAndConsume
in interface OMNode
serializeAndConsume
in class NodeImpl
javax.xml.stream.XMLStreamException
public void serialize(OutputStream output, OMOutputFormat format) throws javax.xml.stream.XMLStreamException
OMContainer
serialize
in interface OMContainer
serialize
in interface OMNode
serialize
in class NodeImpl
javax.xml.stream.XMLStreamException
public void setXMLVersion(String version)
OMDocument
setXMLVersion
in interface OMDocument
XML 1.0
,
XML 1.1
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()
getOMDocumentElement
in interface OMDocument
OMDocument.getOMDocumentElement()
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 arg0, String arg1, String arg2) throws DOMException
renameNode
in interface Document
DOMException
public void setDocumentURI(String arg0)
setDocumentURI
in interface Document
public void setStrictErrorChecking(boolean arg0)
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(javax.xml.stream.XMLStreamWriter writer, boolean cache, boolean includeXMLDeclaration) throws javax.xml.stream.XMLStreamException
Copyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.