Package org.zkoss.idom
Class Document
- java.lang.Object
-
- org.zkoss.idom.impl.AbstractItem
-
- org.zkoss.idom.impl.AbstractGroup
-
- org.zkoss.idom.Document
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,org.w3c.dom.Document,org.w3c.dom.Node,Group,Item
public class Document extends AbstractGroup implements org.w3c.dom.Document
Represents Document which is also W3C/DOM's document, i.e., org.w3c.dom.Document.- Author:
- tomyeh
- See Also:
Element, Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classDocument.ChildArray-
Nested classes/interfaces inherited from class org.zkoss.idom.impl.AbstractGroup
AbstractGroup.ElementMap
-
-
Field Summary
-
Fields inherited from class org.zkoss.idom.impl.AbstractGroup
_children
-
Fields inherited from interface org.zkoss.idom.Item
FIND_BY_PREFIX, FIND_BY_REGEX, FIND_BY_TAGNAME, FIND_IGNORE_CASE, FIND_RECURSIVE
-
Fields inherited from interface org.w3c.dom.Node
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
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.w3c.dom.NodeadoptNode(org.w3c.dom.Node source)org.w3c.dom.AttrcreateAttribute(java.lang.String lname)org.w3c.dom.AttrcreateAttributeNS(java.lang.String nsURI, java.lang.String tname)org.w3c.dom.CDATASectioncreateCDATASection(java.lang.String data)org.w3c.dom.CommentcreateComment(java.lang.String data)org.w3c.dom.DocumentFragmentcreateDocumentFragment()org.w3c.dom.ElementcreateElement(java.lang.String lname)org.w3c.dom.ElementcreateElementNS(java.lang.String nsURI, java.lang.String tname)org.w3c.dom.EntityReferencecreateEntityReference(java.lang.String name)org.w3c.dom.ProcessingInstructioncreateProcessingInstruction(java.lang.String target, java.lang.String data)org.w3c.dom.TextcreateTextNode(java.lang.String data)org.w3c.dom.DocumentTypegetDoctype()DocTypegetDocType()Gets the document type.org.w3c.dom.ElementgetDocumentElement()java.lang.StringgetDocumentURI()org.w3c.dom.DOMConfigurationgetDomConfig()org.w3c.dom.ElementgetElementById(java.lang.String elementId)org.w3c.dom.NodeListgetElementsByTagName(java.lang.String tname)Gets elements that matches the tag name.org.w3c.dom.NodeListgetElementsByTagNameNS(java.lang.String nsURI, java.lang.String lname)Gets elements that matches the tag name and namespace.org.w3c.dom.DOMImplementationgetImplementation()java.lang.StringgetInputEncoding()java.lang.StringgetName()Gets the name of the item.shortgetNodeType()ElementgetRootElement()Gets the root element.booleangetStrictErrorChecking()java.lang.StringgetXmlEncoding()booleangetXmlStandalone()java.lang.StringgetXmlVersion()org.w3c.dom.NodeimportNode(org.w3c.dom.Node importedNode, boolean deep)protected java.util.List<Item>newChildren()Creates a list to hold child vertices.voidnormalizeDocument()org.w3c.dom.NoderenameNode(org.w3c.dom.Node n, java.lang.String namespaceURI, java.lang.String qualifiedName)voidsetDocType(DocType docType)Sets the document type.voidsetDocumentURI(java.lang.String documentURI)voidsetRootElement(Element root)Sets the root element.voidsetStrictErrorChecking(boolean strictErrorChecking)voidsetXmlStandalone(boolean xmlStandalone)voidsetXmlVersion(java.lang.String xmlVersion)java.lang.StringtoString()-
Methods inherited from class org.zkoss.idom.impl.AbstractGroup
anyElement, appendChild, clone, coalesce, detachChildren, getChildNodes, getChildren, getElement, getElement, getElementIndex, getElementIndex, getElementNames, getElements, getElements, getElements, getElementValue, getElementValue, getFirstChild, getLastChild, hasChildNodes, insertBefore, removeChild, replaceChild
-
Methods inherited from class org.zkoss.idom.impl.AbstractItem
cloneNode, compareDocumentPosition, detach, equals, getAttributes, getBaseURI, getDocument, getFeature, getLocalName, getLocator, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParent, getParentNode, getPrefix, getPreviousSibling, getText, getTextContent, getUserData, hasAttributes, hashCode, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, match, normalize, setLocator, setName, setNodeValue, setParent, setPrefix, setText, setTextContent, setUserData
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.zkoss.idom.Item
detach, getDocument, getLocator, getParent, getText, setLocator, setName, setParent, setText
-
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
-
-
-
-
Method Detail
-
getRootElement
public final Element getRootElement()
Gets the root element.
-
setRootElement
public final void setRootElement(Element root)
Sets the root element.
-
getDocType
public final DocType getDocType()
Gets the document type.
-
setDocType
public final void setDocType(DocType docType)
Sets the document type.
-
newChildren
protected final java.util.List<Item> newChildren()
Description copied from class:AbstractGroupCreates a list to hold child vertices. Note: the list must be able to protect itself from adding unexpected child -- read-only, wrong type, undetached...The default implementation obeys the semantic of Element, i.e., it doesn't allow any child that cannot be a child of Element.
For performance issue, we introduced a map to improve the search speed for Element node associated with a tag name.
- Overrides:
newChildrenin classAbstractGroup
-
getName
public final java.lang.String getName()
Description copied from interface:ItemGets the name of the item. For vertices that support namespace (implements Namespaceable), it is the same as getTagName.- Specified by:
getNamein interfaceItem- See Also:
Namespaceable.getTagName()
-
getNodeType
public final short getNodeType()
- Specified by:
getNodeTypein interfaceorg.w3c.dom.Node
-
getDoctype
public final org.w3c.dom.DocumentType getDoctype()
- Specified by:
getDoctypein interfaceorg.w3c.dom.Document
-
getDocumentElement
public final org.w3c.dom.Element getDocumentElement()
- Specified by:
getDocumentElementin interfaceorg.w3c.dom.Document
-
getImplementation
public final org.w3c.dom.DOMImplementation getImplementation()
- Specified by:
getImplementationin interfaceorg.w3c.dom.Document
-
createElement
public final org.w3c.dom.Element createElement(java.lang.String lname)
- Specified by:
createElementin interfaceorg.w3c.dom.Document
-
createElementNS
public final org.w3c.dom.Element createElementNS(java.lang.String nsURI, java.lang.String tname)- Specified by:
createElementNSin interfaceorg.w3c.dom.Document
-
createAttribute
public final org.w3c.dom.Attr createAttribute(java.lang.String lname)
- Specified by:
createAttributein interfaceorg.w3c.dom.Document
-
createAttributeNS
public final org.w3c.dom.Attr createAttributeNS(java.lang.String nsURI, java.lang.String tname)- Specified by:
createAttributeNSin interfaceorg.w3c.dom.Document
-
createDocumentFragment
public final org.w3c.dom.DocumentFragment createDocumentFragment()
- Specified by:
createDocumentFragmentin interfaceorg.w3c.dom.Document
-
createTextNode
public final org.w3c.dom.Text createTextNode(java.lang.String data)
- Specified by:
createTextNodein interfaceorg.w3c.dom.Document
-
createComment
public final org.w3c.dom.Comment createComment(java.lang.String data)
- Specified by:
createCommentin interfaceorg.w3c.dom.Document
-
createCDATASection
public final org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
- Specified by:
createCDATASectionin interfaceorg.w3c.dom.Document
-
createProcessingInstruction
public final org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)- Specified by:
createProcessingInstructionin interfaceorg.w3c.dom.Document
-
createEntityReference
public final org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
- Specified by:
createEntityReferencein interfaceorg.w3c.dom.Document
-
getElementsByTagName
public final org.w3c.dom.NodeList getElementsByTagName(java.lang.String tname)
Gets elements that matches the tag name.Unlike other implementations (Xerces or Crimson), the returned list is a snapshot of the current tree -- not a "live" representation.
- Specified by:
getElementsByTagNamein interfaceorg.w3c.dom.Document
-
getElementsByTagNameNS
public final org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String nsURI, java.lang.String lname)Gets elements that matches the tag name and namespace.Unlike other implementations (Xerces or Crimson), the returned list is a snapshot of the current tree -- not a "live" representation.
- Specified by:
getElementsByTagNameNSin interfaceorg.w3c.dom.Document
-
getElementById
public final org.w3c.dom.Element getElementById(java.lang.String elementId)
- Specified by:
getElementByIdin interfaceorg.w3c.dom.Document
-
importNode
public final org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)- Specified by:
importNodein interfaceorg.w3c.dom.Document
-
getInputEncoding
public java.lang.String getInputEncoding()
- Specified by:
getInputEncodingin interfaceorg.w3c.dom.Document
-
getXmlEncoding
public java.lang.String getXmlEncoding()
- Specified by:
getXmlEncodingin interfaceorg.w3c.dom.Document
-
getXmlStandalone
public boolean getXmlStandalone()
- Specified by:
getXmlStandalonein interfaceorg.w3c.dom.Document
-
setXmlStandalone
public void setXmlStandalone(boolean xmlStandalone) throws DOMException- Specified by:
setXmlStandalonein interfaceorg.w3c.dom.Document- Throws:
DOMException
-
getXmlVersion
public java.lang.String getXmlVersion()
- Specified by:
getXmlVersionin interfaceorg.w3c.dom.Document
-
setXmlVersion
public void setXmlVersion(java.lang.String xmlVersion) throws DOMException- Specified by:
setXmlVersionin interfaceorg.w3c.dom.Document- Throws:
DOMException
-
getStrictErrorChecking
public boolean getStrictErrorChecking()
- Specified by:
getStrictErrorCheckingin interfaceorg.w3c.dom.Document
-
setStrictErrorChecking
public void setStrictErrorChecking(boolean strictErrorChecking)
- Specified by:
setStrictErrorCheckingin interfaceorg.w3c.dom.Document
-
getDocumentURI
public java.lang.String getDocumentURI()
- Specified by:
getDocumentURIin interfaceorg.w3c.dom.Document
-
setDocumentURI
public void setDocumentURI(java.lang.String documentURI)
- Specified by:
setDocumentURIin interfaceorg.w3c.dom.Document
-
adoptNode
public org.w3c.dom.Node adoptNode(org.w3c.dom.Node source) throws DOMException- Specified by:
adoptNodein interfaceorg.w3c.dom.Document- Throws:
DOMException
-
getDomConfig
public org.w3c.dom.DOMConfiguration getDomConfig()
- Specified by:
getDomConfigin interfaceorg.w3c.dom.Document
-
normalizeDocument
public void normalizeDocument()
- Specified by:
normalizeDocumentin interfaceorg.w3c.dom.Document
-
renameNode
public org.w3c.dom.Node renameNode(org.w3c.dom.Node n, java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException- Specified by:
renameNodein interfaceorg.w3c.dom.Document- Throws:
DOMException
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-