public class DelegatingDocument extends DelegatingNode implements Document
In order to specialise the nodes which appear in a DOM,
you have to override the protected createDelegating*
methods to return your own custom DelegatingNode subclasses.
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
Constructor and Description |
---|
DelegatingDocument(Document base,
String documentURI)
Constructs a new document which delegates its behaviour to a
Document from another DOM. |
DelegatingDocument(String documentURI)
Constructs a new empty document based on a new empty document
got from the default DOM implementation.
|
Modifier and Type | Method and Description |
---|---|
Node |
adoptNode(Node source) |
Attr |
createAttribute(String name) |
Attr |
createAttributeNS(String namespaceURI,
String qualifiedName) |
CDATASection |
createCDATASection(String data) |
Comment |
createComment(String data) |
protected DelegatingAttr |
createDelegatingAttr(Attr baseNode)
Creates a new node in this document that delegates to an object
of class
Attr
in the base model. |
protected DelegatingAttr |
createDelegatingAttr(Attr baseNode,
boolean isId)
Creates a new node in this document that delegates to an object
of class
Attr and knows whether it is an
ID-type attribute or not. |
protected DelegatingCDATASection |
createDelegatingCDATASection(CDATASection baseNode)
Creates a new node in this document that delegates to an object
of class
CDATASection
in the base model. |
protected DelegatingCharacterData |
createDelegatingCharacterData(CharacterData baseNode)
Creates a new node in this document that delegates to an object
of class
CharacterData (not one of its subclasses)
in the base model. |
protected DelegatingComment |
createDelegatingComment(Comment baseNode)
Creates a new node in this document that delegates to an object
of class
Comment
in the base model. |
protected DelegatingDocumentFragment |
createDelegatingDocumentFragment(DocumentFragment baseNode)
Creates a new node in this document that delegates to an object
of class
DocumentFragment
in the base model. |
protected DelegatingDocumentType |
createDelegatingDocumentType(DocumentType baseNode)
Creates a new node in this document that delegates to an object
of class
DocumentType
in the base model. |
protected DelegatingElement |
createDelegatingElement(Element baseNode)
Creates a new node in this document that delegates to an object
of class
Element
in the base model. |
protected DelegatingEntity |
createDelegatingEntity(Entity baseNode)
Creates a new node in this document that delegates to an object
of class
Entity
in the base model. |
protected DelegatingEntityReference |
createDelegatingEntityReference(EntityReference baseNode)
Creates a new node in this document that delegates to an object
of class
EntityReference
in the base model. |
protected NamedNodeMap |
createDelegatingNamedNodeMap(NamedNodeMap baseMap)
Returns a NamedNodeMap which will dispense nodes in this document.
|
protected NodeList |
createDelegatingNodeList(NodeList baseList)
Returns a NodeList which will dispense nodes in this document.
|
protected DelegatingNotation |
createDelegatingNotation(Notation baseNode)
Creates a new node in this document that delegates to an object
of class
Notation
in the base model. |
protected DelegatingProcessingInstruction |
createDelegatingProcessingInstruction(ProcessingInstruction baseNode)
Creates a new node in this document that delegates to an object
of class
ProcessingInstruction
in the base model. |
protected DelegatingNode |
createDelegatingSimpleNode(Node baseNode)
Creates a new node in this document that delegates to an object
of class
Node (not one of its subclasses)
in the base model. |
protected DelegatingText |
createDelegatingText(Text baseNode)
Creates a new node in this document that delegates to an object
of class
Text (not one of its subclasses)
in the base model. |
DocumentFragment |
createDocumentFragment() |
Element |
createElement(String tagName) |
Element |
createElementNS(String namespaceURI,
String qualifiedName) |
EntityReference |
createEntityReference(String name) |
ProcessingInstruction |
createProcessingInstruction(String target,
String data) |
Text |
createTextNode(String data) |
protected Document |
getBaseDocument()
Returns the base document (the one to which this delegates).
|
protected DelegatingNode |
getDelegator(Node baseNode)
Returns the node in this document which delegates to (is based on)
a given node in the base document.
|
DocumentType |
getDoctype() |
Element |
getDocumentElement() |
String |
getDocumentURI() |
DOMConfiguration |
getDomConfig() |
Element |
getElementById(String elementId) |
NodeList |
getElementsByTagName(String tagname) |
NodeList |
getElementsByTagNameNS(String namespaceURI,
String localName) |
DOMImplementation |
getImplementation()
Returns the implementation of the base document.
|
String |
getInputEncoding() |
boolean |
getStrictErrorChecking() |
String |
getXmlEncoding() |
boolean |
getXmlStandalone() |
String |
getXmlVersion() |
Node |
importNode(Node importedNode,
boolean deep) |
void |
normalizeDocument() |
Node |
renameNode(Node node,
String namespaceURI,
String qualifiedName) |
void |
setDocumentURI(String documentURI) |
void |
setStrictErrorChecking(boolean strictErrorChecking) |
void |
setXmlStandalone(boolean xmlStandalone) |
void |
setXmlVersion(String xmlVersion) |
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
appendChild, cloneNode, compareDocumentPosition, getAttributes, getBaseURI, getChildNodes, getFeature, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, hasChildNodes, insertBefore, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, normalize, removeChild, replaceChild, setNodeValue, setPrefix, setTextContent, setUserData
public DelegatingDocument(Document base, String documentURI)
Document
from another DOM.base
- delegate document nodedocumentURI
- location of the document, or null
public DelegatingDocument(String documentURI)
documentURI
- location of the document, or null
protected DelegatingNode getDelegator(Node baseNode)
baseNode
- node in the base documentprotected Document getBaseDocument()
protected DelegatingNode createDelegatingSimpleNode(Node baseNode)
Node
(not one of its subclasses)
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingAttr createDelegatingAttr(Attr baseNode)
Attr
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingAttr createDelegatingAttr(Attr baseNode, boolean isId)
Attr
and knows whether it is an
ID-type attribute or not. This is not called by any method of
this class, but can be used by subclass implementations of
createDelegatingAttr(org.w3c.dom.Attr)
.baseNode
- delegate nodeisId
- true if this node knows it is an ID, false if it knows
it isn'tbaseNode
protected DelegatingCDATASection createDelegatingCDATASection(CDATASection baseNode)
CDATASection
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingCharacterData createDelegatingCharacterData(CharacterData baseNode)
CharacterData
(not one of its subclasses)
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingComment createDelegatingComment(Comment baseNode)
Comment
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingDocumentFragment createDelegatingDocumentFragment(DocumentFragment baseNode)
DocumentFragment
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingDocumentType createDelegatingDocumentType(DocumentType baseNode)
DocumentType
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingElement createDelegatingElement(Element baseNode)
Element
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingEntity createDelegatingEntity(Entity baseNode)
Entity
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingEntityReference createDelegatingEntityReference(EntityReference baseNode)
EntityReference
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingNotation createDelegatingNotation(Notation baseNode)
Notation
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingProcessingInstruction createDelegatingProcessingInstruction(ProcessingInstruction baseNode)
ProcessingInstruction
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected DelegatingText createDelegatingText(Text baseNode)
Text
(not one of its subclasses)
in the base model. This may be overridden to create specialised
node types.baseNode
- delegate nodebaseNode
protected NodeList createDelegatingNodeList(NodeList baseList)
baseList
- node list which dispenses nodes in the base documentbaseList
in this documentprotected NamedNodeMap createDelegatingNamedNodeMap(NamedNodeMap baseMap)
baseMap
- node map which dispenses nodes in the base documentbaseMap
in this documentpublic DOMImplementation getImplementation()
getImplementation
in interface Document
public DocumentType getDoctype()
getDoctype
in interface Document
public Element getDocumentElement()
getDocumentElement
in interface Document
public Element createElement(String tagName)
createElement
in interface Document
public DocumentFragment createDocumentFragment()
createDocumentFragment
in interface Document
public Text createTextNode(String data)
createTextNode
in interface Document
public Comment createComment(String data)
createComment
in interface Document
public CDATASection createCDATASection(String data)
createCDATASection
in interface Document
public ProcessingInstruction createProcessingInstruction(String target, String data)
createProcessingInstruction
in interface Document
public Attr createAttribute(String name)
createAttribute
in interface Document
public EntityReference createEntityReference(String name)
createEntityReference
in interface Document
public NodeList getElementsByTagName(String tagname)
getElementsByTagName
in interface Document
public Node importNode(Node importedNode, boolean deep)
importNode
in interface Document
public Element createElementNS(String namespaceURI, String qualifiedName)
createElementNS
in interface Document
public Attr createAttributeNS(String namespaceURI, String qualifiedName)
createAttributeNS
in interface Document
public NodeList getElementsByTagNameNS(String namespaceURI, String localName)
getElementsByTagNameNS
in interface Document
public Element getElementById(String elementId)
getElementById
in interface Document
public String getInputEncoding()
getInputEncoding
in interface Document
public String getXmlEncoding()
getXmlEncoding
in interface Document
public boolean getXmlStandalone()
getXmlStandalone
in interface Document
public void setXmlStandalone(boolean xmlStandalone)
setXmlStandalone
in interface Document
public String getXmlVersion()
getXmlVersion
in interface Document
public void setXmlVersion(String xmlVersion)
setXmlVersion
in interface Document
public boolean getStrictErrorChecking()
getStrictErrorChecking
in interface Document
public void setStrictErrorChecking(boolean strictErrorChecking)
setStrictErrorChecking
in interface Document
public String getDocumentURI()
getDocumentURI
in interface Document
public void setDocumentURI(String documentURI)
setDocumentURI
in interface Document
public DOMConfiguration getDomConfig()
getDomConfig
in interface Document
public void normalizeDocument()
normalizeDocument
in interface Document
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.