Enhydra 5.1 API

org.enhydra.xml.lazydom
Class LazyDocumentType

java.lang.Object
  |
  +--org.apache.xerces.dom.NodeImpl
        |
        +--org.apache.xerces.dom.ChildNode
              |
              +--org.apache.xerces.dom.ParentNode
                    |
                    +--org.apache.xerces.dom.DocumentTypeImpl
                          |
                          +--org.enhydra.xml.lazydom.LazyDocumentType
All Implemented Interfaces:
java.lang.Cloneable, DocumentType, EventTarget, LazyNode, Node, NodeList, java.io.Serializable

public class LazyDocumentType
extends DocumentTypeImpl
implements LazyNode

Implementation of the DOM Attr that supports lazy instantiation of a template DOM.

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.apache.xerces.dom.DocumentTypeImpl
elements, entities, internalSubset, name, notations, publicID, systemID
 
Fields inherited from class org.apache.xerces.dom.ParentNode
fCachedChild, fCachedChildIndex, fCachedLength, firstChild, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, IGNORABLEWS, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, UNNORMALIZED
 
Fields inherited from interface org.enhydra.xml.lazydom.LazyNode
DOCUMENT_NODE_ID, NULL_NODE_ID
 
Fields inherited from interface org.w3c.dom.Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODE
 
Constructor Summary
LazyDocumentType(LazyDocument ownerDoc, LazyDocumentType template, java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String internalSubset)
          Constructor.
 
Method Summary
 Node cloneNode(boolean deep)
          Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes.
 NamedNodeMap getEntities()
          Access the collection of general Entities, both external and internal, defined in the DTD.
 int getNodeId()
          Get the node numeric id number.
 NamedNodeMap getNotations()
          Access the collection of Notations defined in the DTD.
 LazyDocumentType getTemplateDocumentType()
          Get the template for this node.
 LazyNode getTemplateNode()
          Get the template node as a LazyNode.
 boolean isContentsExpanded()
          Is the contents expanded?
 boolean isTemplateNode()
          Check if this node is a template node.
 void makeTemplateNode(int nodeId)
           
 void setNodeValue(java.lang.String value)
          Set the node value, invalidating the id.
protected  void setOwnerDocument(LazyDocument doc)
          Set the owner of the document.
 LazyNode templateClone(Document ownerDocument)
          Create a new node, using this node as the template.
 
Methods inherited from class org.apache.xerces.dom.DocumentTypeImpl
getElements, getInternalSubset, getName, getNodeName, getNodeType, getPublicId, getSystemId, setInternalSubset, setOwnerDocument, setReadOnly
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodes, getChildNodesUnoptimized, getFirstChild, getLastChild, getLength, getOwnerDocument, hasChildNodes, insertBefore, item, normalize, removeChild, replaceChild, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, appendChild, changed, changes, dispatchEvent, getAttributes, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, hasAttributes, isSupported, removeEventListener, setPrefix, setUserData, synchronizeData, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.w3c.dom.Node
appendChild, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setPrefix
 

Constructor Detail

LazyDocumentType

public LazyDocumentType(LazyDocument ownerDoc,
                        LazyDocumentType template,
                        java.lang.String name,
                        java.lang.String publicId,
                        java.lang.String systemId,
                        java.lang.String internalSubset)
Constructor.

Parameters:
ownerDoc - The document that owns this node.
template - If not-null, get the parameters from this template.
name - Document type name. Will be ignored if template is not-null.
publicId - The public id. Will be ignored if template is not-null.
systemId - The system id. Will be ignored if template is not-null.
internalSubset - A string representation of the internal subset. Will be ignored if template is not-null.
Method Detail

setOwnerDocument

protected void setOwnerDocument(LazyDocument doc)
Set the owner of the document. Use to solve chicken and egg problem with creating document with document type.


getTemplateDocumentType

public LazyDocumentType getTemplateDocumentType()
Get the template for this node.

See Also:
LazyNode.getTemplateNode()

cloneNode

public Node cloneNode(boolean deep)
Description copied from interface: Node
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. The duplicate node has no parent; ( parentNode is null.).
Cloning an Element copies all attributes and their values, including those generated by the XML processor to represent defaulted attributes, but this method does not copy any text it contains unless it is a deep clone, since the text is contained in a child Text node. Cloning an Attribute directly, as opposed to be cloned as part of an Element cloning operation, returns a specified attribute ( specified is true). Cloning any other type of node simply returns a copy of this node.
Note that cloning an immutable subtree results in a mutable copy, but the children of an EntityReference clone are readonly . In addition, clones of unspecified Attr nodes are specified. And, cloning Document, DocumentType, Entity, and Notation nodes is implementation dependent.

Specified by:
cloneNode in interface Node
Overrides:
cloneNode in class DocumentTypeImpl
Returns:
The duplicate node.
See Also:
Node.cloneNode(boolean)

isContentsExpanded

public boolean isContentsExpanded()
Is the contents expanded?


getEntities

public NamedNodeMap getEntities()
Description copied from class: DocumentTypeImpl
Access the collection of general Entities, both external and internal, defined in the DTD. For example, in:

   <!doctype example SYSTEM "ex.dtd" [
     <!ENTITY foo "foo">
     <!ENTITY bar "bar">
     <!ENTITY % baz "baz">
     ]>
 

The Entities map includes foo and bar, but not baz. It is promised that only Nodes which are Entities will exist in this NamedNodeMap.

For HTML, this will always be null.

Note that "built in" entities such as & and < should be converted to their actual characters before being placed in the DOM's contained text, and should be converted back when the DOM is rendered as XML or HTML, and hence DO NOT appear here.

Specified by:
getEntities in interface DocumentType
Overrides:
getEntities in class DocumentTypeImpl
See Also:
DocumentType.getEntities()

getNotations

public NamedNodeMap getNotations()
Description copied from class: DocumentTypeImpl
Access the collection of Notations defined in the DTD. A notation declares, by name, the format of an XML unparsed entity or is used to formally declare a Processing Instruction target.

Specified by:
getNotations in interface DocumentType
Overrides:
getNotations in class DocumentTypeImpl
See Also:
DocumentType.getNotations()

makeTemplateNode

public void makeTemplateNode(int nodeId)
Specified by:
makeTemplateNode in interface LazyNode

getNodeId

public int getNodeId()
Description copied from interface: LazyNode
Get the node numeric id number.

Specified by:
getNodeId in interface LazyNode
See Also:
LazyNode.getNodeId()

isTemplateNode

public boolean isTemplateNode()
Description copied from interface: LazyNode
Check if this node is a template node.

Specified by:
isTemplateNode in interface LazyNode
See Also:
LazyNode.isTemplateNode()

getTemplateNode

public LazyNode getTemplateNode()
Description copied from interface: LazyNode
Get the template node as a LazyNode.

Specified by:
getTemplateNode in interface LazyNode
See Also:
LazyNode.getTemplateNode()

templateClone

public LazyNode templateClone(Document ownerDocument)
Description copied from interface: LazyNode
Create a new node, using this node as the template.

Specified by:
templateClone in interface LazyNode
See Also:
LazyNode.templateClone(org.w3c.dom.Document)

setNodeValue

public void setNodeValue(java.lang.String value)
Set the node value, invalidating the id. All node data is modified by this routine.

Specified by:
setNodeValue in interface Node
Overrides:
setNodeValue in class NodeImpl
See Also:
org.w3c.dom.Node.setNodeValue

Enhydra 5.1 API