|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.enhydra.apache.xerces.dom.NodeImpl | +--org.enhydra.apache.xerces.dom.ChildNode | +--org.enhydra.apache.xerces.dom.ParentNode | +--org.enhydra.apache.xerces.dom.CoreDocumentImpl | +--org.enhydra.apache.xerces.dom.DocumentImpl | +--org.enhydra.xml.lazydom.LazyDocument
A DOM Document that supports lazy instantiation of a template DOM. Nodes in the instance DOM are created as accessed. This can be either by traversing the tree or by direct access to a node by id number. Instantiation of nodes in the middle of the virtual tree is support. Thus a node can exist without a parent being expanded. This is used by XMLC, were the dynamic nodes tend to be towards the leaves of the tree.
Instances contain a reference to a DOM that is a shared template for the document. Each node in the template is assigned an integer node id that be used to index tables to directly look up the template of a node created from the template.
This DOM also supports associating pre-formatted text with some nodes, which is used to avoid exprensive string scanning operations during the output of unmodified nodes.
When a child of a node is requested, all direct children are expanded. This eliminates a lot of difficult book keep. Attributes are treated as a separate set from children, only instantiated when an atttribute is accessed. Expansion of nodes accesed from an existing node works as follows:
To created an extended DOM, one must override both the factory methods that take strings and those that take node ids.
Inner classes inherited from class org.enhydra.apache.xerces.dom.DocumentImpl |
org.enhydra.apache.xerces.dom.DocumentImpl.EnclosingAttr, org.enhydra.apache.xerces.dom.DocumentImpl.LEntry |
Fields inherited from class org.enhydra.apache.xerces.dom.DocumentImpl |
eventListeners, iterators, mutationEvents, ranges, savedEnclosingAttr, serialVersionUID, userData |
Fields inherited from class org.enhydra.apache.xerces.dom.CoreDocumentImpl |
allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, identifiers, kidOK, standalone, version |
Fields inherited from class org.enhydra.apache.xerces.dom.ParentNode |
fCachedChild, fCachedChildIndex, fCachedLength, firstChild, ownerDocument |
Fields inherited from class org.enhydra.apache.xerces.dom.ChildNode |
nextSibling, previousSibling |
Fields inherited from class org.enhydra.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 |
Constructor Summary | |
LazyDocument()
Constructor with no argument, for LazyHTMLDocument. |
|
LazyDocument(DocumentType documentType,
TemplateDOM templateDOM)
Constructor. |
Method Summary | |
Node |
appendChild(Node newChild)
|
void |
appendChildWhileExpanding(Node child)
Append a child during node expansion. |
boolean |
areChildrenExpanded()
Are the children of this node expanded? |
Node |
cloneNode(boolean deep)
|
LazyAttr |
createAttribute(int nodeId)
Create an attribute from a template given its id. |
Attr |
createAttribute(String name)
|
Attr |
createAttributeNS(String namespaceURI,
String qualifiedName)
|
LazyAttr |
createAttributeNS(String namespaceURI,
String qualifiedName,
int nodeId)
Create a template Attr with namespace. |
LazyCDATASection |
createCDATASection(int nodeId)
Create a CDATASection from a template given its id. |
CDATASection |
createCDATASection(String data)
|
LazyComment |
createComment(int nodeId)
Create a comment from a template given its id. |
Comment |
createComment(String data)
|
LazyDocumentType |
createDocumentType(int nodeId)
Create a new DocumentType object (Non-DOM). |
DocumentType |
createDocumentType(String qualifiedName,
String publicID,
String systemID)
Create a new DocumentType object (Non-DOM). |
DocumentType |
createDocumentType(String qualifiedName,
String publicID,
String systemID,
String internalSubset)
Create a new DocumentType object (Non-DOM). |
LazyElement |
createElement(int nodeId)
Create a element from a template given its id. |
Element |
createElement(String tagName)
|
Element |
createElementNS(String namespaceURI,
String qualifiedName)
|
LazyEntity |
createEntity(int nodeId)
Create a new Entity object (Non-DOM). |
Entity |
createEntity(String name)
Create a new Entity object (Non-DOM). |
LazyEntityReference |
createEntityReference(int nodeId)
Create a entity reference from a template given its id. |
EntityReference |
createEntityReference(String name)
|
LazyNotation |
createNotation(int nodeId)
Create a notation node from a template given its id. |
Notation |
createNotation(String name)
See org.w3c.dom.Document#createNotation |
LazyProcessingInstruction |
createProcessingInstruction(int nodeId)
Create a process instruction node from a template given its id. |
ProcessingInstruction |
createProcessingInstruction(String target,
String data)
|
LazyAttr |
createTemplateAttribute(String name,
int nodeId)
Create a template Attr. |
LazyAttr |
createTemplateAttributeNS(String namespaceURI,
String qualifiedName,
int nodeId)
Create a template Attr. |
LazyCDATASection |
createTemplateCDATASection(String data,
int nodeId)
Create a template CDATASection. |
LazyComment |
createTemplateComment(String data,
int nodeId)
Create a template comment. |
LazyDocumentType |
createTemplateDocumentType(String qualifiedName,
String publicID,
String systemID,
String internalSubset,
int nodeId)
Create a template DocumentType. |
LazyElement |
createTemplateElement(String tagName,
int nodeId,
String preFormattedText)
Create a template element. |
LazyElement |
createTemplateElementNS(String namespaceURI,
String qualifiedName,
int nodeId,
String preFormattedText)
Create a template Element with namespace. |
LazyEntity |
createTemplateEntity(String name,
String publicId,
String systemId,
String notationName,
int nodeId)
Create a template Entity. |
LazyEntityReference |
createTemplateEntityReference(String name,
int nodeId)
Create a template EntityReference. |
LazyNotation |
createTemplateNotation(String name,
int nodeId)
Create a template Notation. |
LazyProcessingInstruction |
createTemplateProcessingInstruction(String target,
String data,
int nodeId)
Create a template ProcessingInstruction. |
LazyText |
createTemplateTextNode(String data,
int nodeId,
String preFormattedText)
Create a template text node. |
LazyText |
createTextNode(int nodeId)
Create a text node from a template given its id. |
Text |
createTextNode(String data)
|
protected void |
doExpandChildren(LazyParent node)
Do work of expanding the children of a node, if they are not already expanded. |
protected void |
doExpandParent(LazyParent node)
Do work of expanding the parent of a node, if it is not already expanded. |
protected void |
enterExpansion()
Flag that an expansion is in progress, which is used to detect recursion. |
NodeList |
getChildNodes()
|
DocumentType |
getDoctype()
|
Element |
getDocumentElement()
|
LazyNode |
getExpandedNode(int nodeId)
Get a pointer to a node if its been expanded, otherwise return null. |
Node |
getFirstChild()
|
DOMImplementation |
getImplementation()
|
Node |
getLastChild()
|
LazyNode |
getNodeById(int nodeId)
Get or create a lazy node, given its id. |
LazyNode |
getNodeFromTemplate(LazyNode template)
Get or create a node given, the template node. |
int |
getNodeId()
Get the node numeric id number. |
OutputOptions |
getPreFormatOutputOptions()
Get the OutputOption that were used to format the document. |
LazyDocument |
getTemplateDocument()
Get the template for this node. |
LazyNode |
getTemplateNode()
Get the template node as a LazyNode. |
LazyNode |
getTemplateNode(int nodeId)
Get a template node, given a node id. |
XMLObject |
getXMLObject()
Get the XMLC XMLObject that contains this document, or null it it's not associated with a XMLObject. |
boolean |
hasChildNodes()
|
Node |
insertBefore(Node newChild,
Node refChild)
|
boolean |
isDocTypeExpanded()
Has the DocumentType been expanded? |
boolean |
isParentExpanded()
Is the parent of this node expanded? |
boolean |
isTemplateNode()
Check if this node is a template node. |
protected void |
leaveExpansion()
Flag that an expansion is complete. |
void |
makeTemplateNode(int nodeId)
|
void |
normalize()
|
Node |
removeChild(Node oldChild)
|
Node |
replaceChild(Node newChild,
Node oldChild)
|
void |
setChildrenExpanded()
Flag the children as being expanded. |
void |
setNodeValue(String value)
Set the node value, invalidating the id. |
void |
setParentExpanded()
Flag the parent as being expanded. |
void |
setParentWhileExpanding(Node parent)
Set the parent of this node during expansion. |
void |
setPreFormatOutputOptions(OutputOptions outputOptions)
Set the output options that were used to preformat this document. |
void |
setXMLObject(XMLObject xmlObject)
Set the XMLC XMLObject that contains this document. |
LazyNode |
templateClone(Document ownerDocument)
Create a new node, using this node as the template. |
Methods inherited from class org.enhydra.apache.xerces.dom.DocumentImpl |
addEventListener, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, deletedText, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, getEventListeners, getMutationEvents, getUserData, insertedNode, insertedText, insertingNode, modifiedAttrValue, modifiedCharacterData, modifyingCharacterData, removedAttrNode, removedNode, removeEventListener, removeNodeIterator, removeRange, removingNode, replacedNode, replacedText, replacingNode, saveEnclosingAttr, setAttrNode, setEventListeners, setMutationEvents, setUserData, splitData |
Methods inherited from class org.enhydra.apache.xerces.dom.CoreDocumentImpl |
|
Methods inherited from class org.enhydra.apache.xerces.dom.ParentNode |
checkNormalizationAfterInsert, checkNormalizationAfterRemove, getChildNodesUnoptimized, getLength, internalInsertBefore, internalRemoveChild, item, lastChild, lastChild, ownerDocument, setOwnerDocument, setReadOnly, synchronizeChildren |
Methods inherited from class org.enhydra.apache.xerces.dom.ChildNode |
getNextSibling, getParentNode, getPreviousSibling, parentNode, previousSibling |
Methods inherited from class org.enhydra.apache.xerces.dom.NodeImpl |
addEventListener, compareDocumentPosition, dispatchEvent, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getTextContent, getUserData, getUserData, hasAttributes, hasStringValue, hasStringValue, internalIsIgnorableWhitespace, isDefaultNamespace, isEqualNode, isFirstChild, isFirstChild, isIgnorableWhitespace, isNormalized, isNormalized, isOwned, isOwned, isReadOnly, isReadOnly, isSameNode, isSpecified, isSpecified, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, needsSyncChildren, needsSyncData, needsSyncData, removeEventListener, setPrefix, setTextContent, setUserData, setUserData, synchronizeData, toString |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.w3c.dom.Node |
compareDocumentPosition, getAttributes, getBaseURI, getFeature, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTextContent, getUserData, hasAttributes, isDefaultNamespace, isEqualNode, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, setPrefix, setTextContent, setUserData |
Constructor Detail |
public LazyDocument(DocumentType documentType, TemplateDOM templateDOM)
documentType
- Document type to associate with this document,
or null if no doctype or should be obtained from template.templateDOM
- Template DOM, with each node cotaining a node id.
Maybe null if no associated template.public LazyDocument()
Method Detail |
public Element getDocumentElement()
getDocumentElement
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.getDocumentElement()
public DOMImplementation getImplementation()
getImplementation
in class org.enhydra.apache.xerces.dom.DocumentImpl
Document.getImplementation()
protected final void enterExpansion()
protected final void leaveExpansion()
public final LazyNode getNodeById(int nodeId)
public final LazyNode getNodeFromTemplate(LazyNode template)
getNodeById(int)
protected void doExpandParent(LazyParent node)
protected void doExpandChildren(LazyParent node)
public final LazyNode getExpandedNode(int nodeId)
public final LazyNode getTemplateNode(int nodeId)
public boolean isDocTypeExpanded()
public LazyDocument getTemplateDocument()
LazyNode.getTemplateNode()
public Node cloneNode(boolean deep)
cloneNode
in interface Node
cloneNode
in class org.enhydra.apache.xerces.dom.DocumentImpl
Node.cloneNode(boolean)
public void makeTemplateNode(int nodeId)
makeTemplateNode
in interface LazyNode
public int getNodeId()
LazyNode
getNodeId
in interface LazyNode
LazyNode.getNodeId()
public boolean isTemplateNode()
LazyNode
isTemplateNode
in interface LazyNode
LazyNode.isTemplateNode()
public LazyNode getTemplateNode()
LazyNode
getTemplateNode
in interface LazyNode
LazyNode.getTemplateNode()
public LazyNode templateClone(Document ownerDocument)
LazyNode
templateClone
in interface LazyNode
LazyNode.templateClone(org.w3c.dom.Document)
public void setNodeValue(String value)
setNodeValue
in interface Node
setNodeValue
in class org.enhydra.apache.xerces.dom.NodeImpl
Node.setNodeValue(java.lang.String)
public boolean isParentExpanded()
LazyParent
isParentExpanded
in interface LazyParent
LazyParent.isParentExpanded()
public void setParentExpanded()
LazyParent
setParentExpanded
in interface LazyParent
LazyParent.setParentExpanded()
public void setParentWhileExpanding(Node parent)
LazyParent
setParentWhileExpanding
in interface LazyParent
LazyParent.setParentWhileExpanding(org.w3c.dom.Node)
public boolean areChildrenExpanded()
LazyParent
areChildrenExpanded
in interface LazyParent
LazyParent.areChildrenExpanded()
public void setChildrenExpanded()
LazyParent
setChildrenExpanded
in interface LazyParent
LazyParent.setChildrenExpanded()
public void appendChildWhileExpanding(Node child)
LazyParent
appendChildWhileExpanding
in interface LazyParent
LazyParent.appendChildWhileExpanding(org.w3c.dom.Node)
public NodeList getChildNodes()
getChildNodes
in interface Node
getChildNodes
in class org.enhydra.apache.xerces.dom.ParentNode
Node.getChildNodes()
public Node getFirstChild()
getFirstChild
in interface Node
getFirstChild
in class org.enhydra.apache.xerces.dom.ParentNode
Node.getFirstChild()
public Node getLastChild()
getLastChild
in interface Node
getLastChild
in class org.enhydra.apache.xerces.dom.ParentNode
Node.getLastChild()
public Node insertBefore(Node newChild, Node refChild) throws DOMException
insertBefore
in interface Node
insertBefore
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
replaceChild
in interface Node
replaceChild
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
public Node removeChild(Node oldChild) throws DOMException
removeChild
in interface Node
removeChild
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Node.removeChild(org.w3c.dom.Node)
public Node appendChild(Node newChild) throws DOMException
appendChild
in interface Node
appendChild
in class org.enhydra.apache.xerces.dom.NodeImpl
Node.appendChild(org.w3c.dom.Node)
public boolean hasChildNodes()
hasChildNodes
in interface Node
hasChildNodes
in class org.enhydra.apache.xerces.dom.ParentNode
Node.hasChildNodes()
public void normalize()
normalize
in interface Node
normalize
in class org.enhydra.apache.xerces.dom.ParentNode
Node.normalize()
public DocumentType getDoctype()
getDoctype
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.getDoctype()
public Element createElement(String tagName) throws DOMException
createElement
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createElement(java.lang.String)
public Text createTextNode(String data)
createTextNode
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createTextNode(java.lang.String)
public Comment createComment(String data)
createComment
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createComment(java.lang.String)
public CDATASection createCDATASection(String data) throws DOMException
createCDATASection
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createCDATASection(java.lang.String)
public ProcessingInstruction createProcessingInstruction(String target, String data)
createProcessingInstruction
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createProcessingInstruction(java.lang.String, java.lang.String)
public Attr createAttribute(String name) throws DOMException
createAttribute
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createAttribute(java.lang.String)
public Notation createNotation(String name) throws DOMException
createNotation
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
public EntityReference createEntityReference(String name) throws DOMException
createEntityReference
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createEntityReference(java.lang.String)
public Element createElementNS(String namespaceURI, String qualifiedName) throws DOMException
createElementNS
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createElementNS(java.lang.String, java.lang.String)
public Attr createAttributeNS(String namespaceURI, String qualifiedName) throws DOMException
createAttributeNS
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
Document.createAttributeNS(java.lang.String, java.lang.String)
public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID, String internalSubset) throws DOMException
CoreDocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public DocumentType createDocumentType(String qualifiedName, String publicID, String systemID) throws DOMException
createDocumentType
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
CoreDocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public Entity createEntity(String name) throws DOMException
createEntity
in class org.enhydra.apache.xerces.dom.CoreDocumentImpl
CoreDocumentImpl.createEntity(java.lang.String)
public LazyElement createElement(int nodeId) throws DOMException
Document.createElement(java.lang.String)
public LazyText createTextNode(int nodeId)
Document.createTextNode(java.lang.String)
public LazyComment createComment(int nodeId)
Document.createComment(java.lang.String)
public LazyCDATASection createCDATASection(int nodeId) throws DOMException
Document.createCDATASection(java.lang.String)
public LazyProcessingInstruction createProcessingInstruction(int nodeId)
Document.createProcessingInstruction(java.lang.String, java.lang.String)
public LazyAttr createAttribute(int nodeId) throws DOMException
Document.createAttribute(java.lang.String)
public LazyNotation createNotation(int nodeId) throws DOMException
public LazyEntityReference createEntityReference(int nodeId) throws DOMException
Document.createEntityReference(java.lang.String)
public LazyDocumentType createDocumentType(int nodeId) throws DOMException
CoreDocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public LazyEntity createEntity(int nodeId) throws DOMException
CoreDocumentImpl.createEntity(java.lang.String)
public LazyElement createTemplateElement(String tagName, int nodeId, String preFormattedText) throws DOMException
createElement(String)
,
Document.createElement(java.lang.String)
public LazyText createTemplateTextNode(String data, int nodeId, String preFormattedText)
createTextNode(String)
,
Document.createTextNode(java.lang.String)
public LazyComment createTemplateComment(String data, int nodeId)
createComment(String)
,
Document.createComment(java.lang.String)
public LazyCDATASection createTemplateCDATASection(String data, int nodeId) throws DOMException
createCDATASection(String)
,
Document.createCDATASection(java.lang.String)
public LazyProcessingInstruction createTemplateProcessingInstruction(String target, String data, int nodeId)
createProcessingInstruction(String,String)
,
Document.createProcessingInstruction(java.lang.String, java.lang.String)
public LazyAttr createTemplateAttribute(String name, int nodeId) throws DOMException
createAttribute(String)
,
Document.createAttribute(java.lang.String)
public LazyAttr createTemplateAttributeNS(String namespaceURI, String qualifiedName, int nodeId) throws DOMException
createAttributeNS(String,String)
,
Document.createAttributeNS(java.lang.String, java.lang.String)
public LazyNotation createTemplateNotation(String name, int nodeId) throws DOMException
createNotation(String)
public LazyEntityReference createTemplateEntityReference(String name, int nodeId) throws DOMException
createEntityReference(String)
,
Document.createEntityReference(java.lang.String)
public LazyElement createTemplateElementNS(String namespaceURI, String qualifiedName, int nodeId, String preFormattedText) throws DOMException
createElementNS(String,String)
,
Document.createElementNS(java.lang.String, java.lang.String)
public LazyAttr createAttributeNS(String namespaceURI, String qualifiedName, int nodeId) throws DOMException
createAttributeNS(String,String)
,
Document.createAttributeNS(java.lang.String, java.lang.String)
public LazyDocumentType createTemplateDocumentType(String qualifiedName, String publicID, String systemID, String internalSubset, int nodeId) throws DOMException
createDocumentType(String,String,String,String)
,
CoreDocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public LazyEntity createTemplateEntity(String name, String publicId, String systemId, String notationName, int nodeId) throws DOMException
createEntity(String)
,
CoreDocumentImpl.createEntity(java.lang.String)
public void setPreFormatOutputOptions(OutputOptions outputOptions)
outputOptions
- The output options; should be read-only.public OutputOptions getPreFormatOutputOptions()
PreFormattedTextDocument
getPreFormatOutputOptions
in interface PreFormattedTextDocument
PreFormattedTextDocument.getPreFormatOutputOptions()
public void setXMLObject(XMLObject xmlObject)
XMLObjectLink
setXMLObject
in interface XMLObjectLink
XMLObjectLink.setXMLObject(org.enhydra.xml.xmlc.XMLObject)
public XMLObject getXMLObject()
XMLObjectLink
getXMLObject
in interface XMLObjectLink
XMLObjectLink.getXMLObject()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |