Package uk.ac.starlink.votable.dom
Class DelegatingDocument
- java.lang.Object
-
- uk.ac.starlink.votable.dom.DelegatingNode
-
- uk.ac.starlink.votable.dom.DelegatingDocument
-
- All Implemented Interfaces:
org.w3c.dom.Document,org.w3c.dom.Node
- Direct Known Subclasses:
VODocument
public class DelegatingDocument extends DelegatingNode implements org.w3c.dom.Document
DOM Document implementation which delegates its operations to a base Document instance. This is the basic class which must be used and extended when using the delegate DOM package.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.
- Since:
- 14 Sep 2004
- Author:
- Mark Taylor (Starlink)
-
-
Field Summary
-
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
-
-
Constructor Summary
Constructors Constructor Description DelegatingDocument(java.lang.String documentURI)Constructs a new empty document based on a new empty document got from the default DOM implementation.DelegatingDocument(org.w3c.dom.Document base, java.lang.String documentURI)Constructs a new document which delegates its behaviour to a Document from another DOM.
-
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 name)org.w3c.dom.AttrcreateAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)org.w3c.dom.CDATASectioncreateCDATASection(java.lang.String data)org.w3c.dom.CommentcreateComment(java.lang.String data)protected DelegatingAttrcreateDelegatingAttr(org.w3c.dom.Attr baseNode)Creates a new node in this document that delegates to an object of classAttrin the base model.protected DelegatingAttrcreateDelegatingAttr(org.w3c.dom.Attr baseNode, boolean isId)Creates a new node in this document that delegates to an object of classAttrand knows whether it is an ID-type attribute or not.protected DelegatingCDATASectioncreateDelegatingCDATASection(org.w3c.dom.CDATASection baseNode)Creates a new node in this document that delegates to an object of classCDATASectionin the base model.protected DelegatingCharacterDatacreateDelegatingCharacterData(org.w3c.dom.CharacterData baseNode)Creates a new node in this document that delegates to an object of classCharacterData(not one of its subclasses) in the base model.protected DelegatingCommentcreateDelegatingComment(org.w3c.dom.Comment baseNode)Creates a new node in this document that delegates to an object of classCommentin the base model.protected DelegatingDocumentFragmentcreateDelegatingDocumentFragment(org.w3c.dom.DocumentFragment baseNode)Creates a new node in this document that delegates to an object of classDocumentFragmentin the base model.protected DelegatingDocumentTypecreateDelegatingDocumentType(org.w3c.dom.DocumentType baseNode)Creates a new node in this document that delegates to an object of classDocumentTypein the base model.protected DelegatingElementcreateDelegatingElement(org.w3c.dom.Element baseNode)Creates a new node in this document that delegates to an object of classElementin the base model.protected DelegatingEntitycreateDelegatingEntity(org.w3c.dom.Entity baseNode)Creates a new node in this document that delegates to an object of classEntityin the base model.protected DelegatingEntityReferencecreateDelegatingEntityReference(org.w3c.dom.EntityReference baseNode)Creates a new node in this document that delegates to an object of classEntityReferencein the base model.protected org.w3c.dom.NamedNodeMapcreateDelegatingNamedNodeMap(org.w3c.dom.NamedNodeMap baseMap)Returns a NamedNodeMap which will dispense nodes in this document.protected org.w3c.dom.NodeListcreateDelegatingNodeList(org.w3c.dom.NodeList baseList)Returns a NodeList which will dispense nodes in this document.protected DelegatingNotationcreateDelegatingNotation(org.w3c.dom.Notation baseNode)Creates a new node in this document that delegates to an object of classNotationin the base model.protected DelegatingProcessingInstructioncreateDelegatingProcessingInstruction(org.w3c.dom.ProcessingInstruction baseNode)Creates a new node in this document that delegates to an object of classProcessingInstructionin the base model.protected DelegatingNodecreateDelegatingSimpleNode(org.w3c.dom.Node baseNode)Creates a new node in this document that delegates to an object of classNode(not one of its subclasses) in the base model.protected DelegatingTextcreateDelegatingText(org.w3c.dom.Text baseNode)Creates a new node in this document that delegates to an object of classText(not one of its subclasses) in the base model.org.w3c.dom.DocumentFragmentcreateDocumentFragment()org.w3c.dom.ElementcreateElement(java.lang.String tagName)org.w3c.dom.ElementcreateElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)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)protected org.w3c.dom.DocumentgetBaseDocument()Returns the base document (the one to which this delegates).protected DelegatingNodegetDelegator(org.w3c.dom.Node baseNode)Returns the node in this document which delegates to (is based on) a given node in the base document.org.w3c.dom.DocumentTypegetDoctype()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 tagname)org.w3c.dom.NodeListgetElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)org.w3c.dom.DOMImplementationgetImplementation()Returns the implementation of the base document.java.lang.StringgetInputEncoding()booleangetStrictErrorChecking()java.lang.StringgetXmlEncoding()booleangetXmlStandalone()java.lang.StringgetXmlVersion()org.w3c.dom.NodeimportNode(org.w3c.dom.Node importedNode, boolean deep)voidnormalizeDocument()org.w3c.dom.NoderenameNode(org.w3c.dom.Node node, java.lang.String namespaceURI, java.lang.String qualifiedName)voidsetDocumentURI(java.lang.String documentURI)voidsetStrictErrorChecking(boolean strictErrorChecking)voidsetXmlStandalone(boolean xmlStandalone)voidsetXmlVersion(java.lang.String xmlVersion)-
Methods inherited from class uk.ac.starlink.votable.dom.DelegatingNode
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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.w3c.dom.Node
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
-
-
-
-
Constructor Detail
-
DelegatingDocument
public DelegatingDocument(org.w3c.dom.Document base, java.lang.String documentURI)Constructs a new document which delegates its behaviour to a Document from another DOM.- Parameters:
base- delegate document nodedocumentURI- location of the document, or null
-
DelegatingDocument
public DelegatingDocument(java.lang.String documentURI)
Constructs a new empty document based on a new empty document got from the default DOM implementation. This can theoretically result in a ParserConfigurationException, but shouldn't do for any sensibly set up JVM - any such condition is rethrown as a RuntimeException.- Parameters:
documentURI- location of the document, or null
-
-
Method Detail
-
getDelegator
protected DelegatingNode getDelegator(org.w3c.dom.Node baseNode)
Returns the node in this document which delegates to (is based on) a given node in the base document. If this node has not previously been encountered, it will be created here.- Parameters:
baseNode- node in the base document- Returns:
- corresponding node in this document
-
getBaseDocument
protected org.w3c.dom.Document getBaseDocument()
Returns the base document (the one to which this delegates).- Returns:
- base document
-
createDelegatingSimpleNode
protected DelegatingNode createDelegatingSimpleNode(org.w3c.dom.Node baseNode)
Creates a new node in this document that delegates to an object of classNode(not one of its subclasses) in the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingAttr
protected DelegatingAttr createDelegatingAttr(org.w3c.dom.Attr baseNode)
Creates a new node in this document that delegates to an object of classAttrin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingAttr
protected DelegatingAttr createDelegatingAttr(org.w3c.dom.Attr baseNode, boolean isId)
Creates a new node in this document that delegates to an object of classAttrand 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 ofcreateDelegatingAttr(org.w3c.dom.Attr).- Parameters:
baseNode- delegate nodeisId- true if this node knows it is an ID, false if it knows it isn't- Returns:
- new node in this model based on baseNode
-
createDelegatingCDATASection
protected DelegatingCDATASection createDelegatingCDATASection(org.w3c.dom.CDATASection baseNode)
Creates a new node in this document that delegates to an object of classCDATASectionin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingCharacterData
protected DelegatingCharacterData createDelegatingCharacterData(org.w3c.dom.CharacterData baseNode)
Creates a new node in this document that delegates to an object of classCharacterData(not one of its subclasses) in the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingComment
protected DelegatingComment createDelegatingComment(org.w3c.dom.Comment baseNode)
Creates a new node in this document that delegates to an object of classCommentin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingDocumentFragment
protected DelegatingDocumentFragment createDelegatingDocumentFragment(org.w3c.dom.DocumentFragment baseNode)
Creates a new node in this document that delegates to an object of classDocumentFragmentin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingDocumentType
protected DelegatingDocumentType createDelegatingDocumentType(org.w3c.dom.DocumentType baseNode)
Creates a new node in this document that delegates to an object of classDocumentTypein the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingElement
protected DelegatingElement createDelegatingElement(org.w3c.dom.Element baseNode)
Creates a new node in this document that delegates to an object of classElementin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingEntity
protected DelegatingEntity createDelegatingEntity(org.w3c.dom.Entity baseNode)
Creates a new node in this document that delegates to an object of classEntityin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingEntityReference
protected DelegatingEntityReference createDelegatingEntityReference(org.w3c.dom.EntityReference baseNode)
Creates a new node in this document that delegates to an object of classEntityReferencein the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingNotation
protected DelegatingNotation createDelegatingNotation(org.w3c.dom.Notation baseNode)
Creates a new node in this document that delegates to an object of classNotationin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingProcessingInstruction
protected DelegatingProcessingInstruction createDelegatingProcessingInstruction(org.w3c.dom.ProcessingInstruction baseNode)
Creates a new node in this document that delegates to an object of classProcessingInstructionin the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingText
protected DelegatingText createDelegatingText(org.w3c.dom.Text baseNode)
Creates a new node in this document that delegates to an object of classText(not one of its subclasses) in the base model. This may be overridden to create specialised node types.- Parameters:
baseNode- delegate node- Returns:
- new node in this model based on baseNode
-
createDelegatingNodeList
protected org.w3c.dom.NodeList createDelegatingNodeList(org.w3c.dom.NodeList baseList)
Returns a NodeList which will dispense nodes in this document.- Parameters:
baseList- node list which dispenses nodes in the base document- Returns:
- equivalent of baseList in this document
-
createDelegatingNamedNodeMap
protected org.w3c.dom.NamedNodeMap createDelegatingNamedNodeMap(org.w3c.dom.NamedNodeMap baseMap)
Returns a NamedNodeMap which will dispense nodes in this document.- Parameters:
baseMap- node map which dispenses nodes in the base document- Returns:
- equivalent of baseMap in this document
-
getImplementation
public org.w3c.dom.DOMImplementation getImplementation()
Returns the implementation of the base document.- Specified by:
getImplementationin interfaceorg.w3c.dom.Document
-
getDoctype
public org.w3c.dom.DocumentType getDoctype()
- Specified by:
getDoctypein interfaceorg.w3c.dom.Document
-
getDocumentElement
public org.w3c.dom.Element getDocumentElement()
- Specified by:
getDocumentElementin interfaceorg.w3c.dom.Document
-
createElement
public org.w3c.dom.Element createElement(java.lang.String tagName)
- Specified by:
createElementin interfaceorg.w3c.dom.Document
-
createDocumentFragment
public org.w3c.dom.DocumentFragment createDocumentFragment()
- Specified by:
createDocumentFragmentin interfaceorg.w3c.dom.Document
-
createTextNode
public org.w3c.dom.Text createTextNode(java.lang.String data)
- Specified by:
createTextNodein interfaceorg.w3c.dom.Document
-
createComment
public org.w3c.dom.Comment createComment(java.lang.String data)
- Specified by:
createCommentin interfaceorg.w3c.dom.Document
-
createCDATASection
public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
- Specified by:
createCDATASectionin interfaceorg.w3c.dom.Document
-
createProcessingInstruction
public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)- Specified by:
createProcessingInstructionin interfaceorg.w3c.dom.Document
-
createAttribute
public org.w3c.dom.Attr createAttribute(java.lang.String name)
- Specified by:
createAttributein interfaceorg.w3c.dom.Document
-
createEntityReference
public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
- Specified by:
createEntityReferencein interfaceorg.w3c.dom.Document
-
getElementsByTagName
public org.w3c.dom.NodeList getElementsByTagName(java.lang.String tagname)
- Specified by:
getElementsByTagNamein interfaceorg.w3c.dom.Document
-
importNode
public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)- Specified by:
importNodein interfaceorg.w3c.dom.Document
-
createElementNS
public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)- Specified by:
createElementNSin interfaceorg.w3c.dom.Document
-
createAttributeNS
public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)- Specified by:
createAttributeNSin interfaceorg.w3c.dom.Document
-
getElementsByTagNameNS
public org.w3c.dom.NodeList getElementsByTagNameNS(java.lang.String namespaceURI, java.lang.String localName)- Specified by:
getElementsByTagNameNSin interfaceorg.w3c.dom.Document
-
getElementById
public org.w3c.dom.Element getElementById(java.lang.String elementId)
- Specified by:
getElementByIdin 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)
- Specified by:
setXmlStandalonein interfaceorg.w3c.dom.Document
-
getXmlVersion
public java.lang.String getXmlVersion()
- Specified by:
getXmlVersionin interfaceorg.w3c.dom.Document
-
setXmlVersion
public void setXmlVersion(java.lang.String xmlVersion)
- Specified by:
setXmlVersionin interfaceorg.w3c.dom.Document
-
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)
- Specified by:
adoptNodein interfaceorg.w3c.dom.Document
-
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 node, java.lang.String namespaceURI, java.lang.String qualifiedName)- Specified by:
renameNodein interfaceorg.w3c.dom.Document
-
-