|
Enhydra 3.1.1b1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.xerces.dom.NodeImpl | +--org.apache.xerces.dom.ParentNode | +--org.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.
Fields inherited from class org.apache.xerces.dom.DocumentImpl |
allowGrammarAccess,
changes,
docElement,
docType,
errorChecking,
eventListeners,
identifiers,
iterators,
kidOK,
mutationEvents,
ranges,
userData |
Fields inherited from class org.apache.xerces.dom.ParentNode |
firstChild,
nodeListIndex,
nodeListLength,
nodeListNode,
ownerDocument |
Fields inherited from class org.apache.xerces.dom.NodeImpl |
ELEMENT_DEFINITION_NODE,
FIRSTCHILD,
flags,
IGNORABLEWS,
MUTATION_AGGREGATE,
MUTATION_ALL,
MUTATION_LOCAL,
MUTATION_NONE,
MUTATIONEVENTS,
OWNED,
ownerNode,
READONLY,
SETVALUE,
SPECIFIED,
SYNCCHILDREN,
SYNCDATA |
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 | |
LazyDocument()
Constructor with no argument, for LazyHTMLDocument. |
|
LazyDocument(DocumentType documentType,
TemplateDOM templateDOM)
Constructor. |
Method Summary | |
Node |
appendChild(Node newChild)
Adds the node newChild to the end of the list of children
of this node. |
void |
appendChildWhileExpanding(Node child)
Append a child during node expansion. |
boolean |
areChildrenExpanded()
Are the children of this node expanded? |
Node |
cloneNode(boolean deep)
Returns a duplicate of this node, i.e., serves as a generic copy constructor for nodes. |
LazyAttr |
createAttribute(int nodeId)
Create an attribute from a template given its id. |
Attr |
createAttribute(java.lang.String name)
Creates an Attr of the given name. |
Attr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an attribute of the given qualified name and namespace URI. |
LazyAttr |
createAttributeNS(java.lang.String namespaceURI,
java.lang.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(java.lang.String data)
Creates a CDATASection node whose value is the specified
string. |
LazyComment |
createComment(int nodeId)
Create a comment from a template given its id. |
Comment |
createComment(java.lang.String data)
Creates a Comment node given the specified string. |
LazyDocumentType |
createDocumentType(int nodeId)
Create a new DocumentType object (Non-DOM). |
DocumentType |
createDocumentType(java.lang.String qualifiedName,
java.lang.String publicID,
java.lang.String systemID)
Create a new DocumentType object (Non-DOM). |
DocumentType |
createDocumentType(java.lang.String qualifiedName,
java.lang.String publicID,
java.lang.String systemID,
java.lang.String internalSubset)
Create a new DocumentType object (Non-DOM). |
LazyElement |
createElement(int nodeId)
Create a element from a template given its id. |
Element |
createElement(java.lang.String tagName)
Creates an element of the type specified. |
Element |
createElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName)
Creates an element of the given qualified name and namespace URI. |
LazyEntity |
createEntity(int nodeId)
Create a new Entity object (Non-DOM). |
Entity |
createEntity(java.lang.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(java.lang.String name)
Creates an EntityReference object. |
LazyNotation |
createNotation(int nodeId)
Create a notation node from a template given its id. |
Notation |
createNotation(java.lang.String name)
|
LazyProcessingInstruction |
createProcessingInstruction(int nodeId)
Create a process instruction node from a template given its id. |
ProcessingInstruction |
createProcessingInstruction(java.lang.String target,
java.lang.String data)
Creates a ProcessingInstruction node given the specified
name and data strings. |
LazyAttr |
createTemplateAttribute(java.lang.String name,
int nodeId)
Create a template Attr. |
LazyAttr |
createTemplateAttributeNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
int nodeId)
Create a template Attr. |
LazyCDATASection |
createTemplateCDATASection(java.lang.String data,
int nodeId)
Create a template CDATASection. |
LazyComment |
createTemplateComment(java.lang.String data,
int nodeId)
Create a template comment. |
LazyDocumentType |
createTemplateDocumentType(java.lang.String qualifiedName,
java.lang.String publicID,
java.lang.String systemID,
java.lang.String internalSubset,
int nodeId)
Create a template DocumentType. |
LazyElement |
createTemplateElement(java.lang.String tagName,
int nodeId,
java.lang.String preFormattedText)
Create a template element. |
LazyElement |
createTemplateElementNS(java.lang.String namespaceURI,
java.lang.String qualifiedName,
int nodeId,
java.lang.String preFormattedText)
Create a template Element with namespace. |
LazyEntity |
createTemplateEntity(java.lang.String name,
java.lang.String publicId,
java.lang.String systemId,
java.lang.String notationName,
int nodeId)
Create a template Entity. |
LazyEntityReference |
createTemplateEntityReference(java.lang.String name,
int nodeId)
Create a template EntityReference. |
LazyNotation |
createTemplateNotation(java.lang.String name,
int nodeId)
Create a template Notation. |
LazyProcessingInstruction |
createTemplateProcessingInstruction(java.lang.String target,
java.lang.String data,
int nodeId)
Create a template ProcessingInstruction. |
LazyText |
createTemplateTextNode(java.lang.String data,
int nodeId,
java.lang.String preFormattedText)
Create a template text node. |
LazyText |
createTextNode(int nodeId)
Create a text node from a template given its id. |
Text |
createTextNode(java.lang.String data)
Creates a Text node given the specified string. |
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()
A NodeList that contains all children of this node. |
DocumentType |
getDoctype()
The Document Type Declaration (see DocumentType )
associated with this document. |
Element |
getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. |
LazyNode |
getExpandedNode(int nodeId)
Get a pointer to a node if its been expanded, otherwise return null. |
Node |
getFirstChild()
The first child of this node. |
DOMImplementation |
getImplementation()
The DOMImplementation object that handles this document. |
Node |
getLastChild()
The last child of this node. |
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()
|
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()
|
boolean |
hasChildNodes()
This is a convenience method to allow easy determination of whether a node has any children. |
Node |
insertBefore(Node newChild,
Node refChild)
Inserts the node newChild before the existing child 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()
Puts all Text nodes in the full depth of the sub-tree
underneath this Node , including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text nodes, i.e., there are neither adjacent
Text nodes nor empty Text nodes. |
Node |
removeChild(Node oldChild)
Removes the child node indicated by oldChild from the
list of children, and returns it. |
Node |
replaceChild(Node newChild,
Node oldChild)
Replaces the child node oldChild with
newChild in the list of children, and returns the
oldChild node. |
void |
setChildrenExpanded()
Flag the children as being expanded. |
void |
setNodeValue(java.lang.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)
|
LazyNode |
templateClone(Document ownerDocument)
Create a new node, using this node as the template. |
Methods inherited from class org.apache.xerces.dom.DocumentImpl |
adoptNode,
changed,
changes,
clone,
createDocumentFragment,
createElementDefinition,
createEvent,
createNodeIterator,
createNodeIterator,
createRange,
createTreeWalker,
createTreeWalker,
getElementById,
getElementsByTagName,
getElementsByTagNameNS,
getErrorChecking,
getEventListeners,
getIdentifier,
getIdentifiers,
getMutationEvents,
getNodeName,
getNodeType,
getOwnerDocument,
getUserData,
importNode,
isKidOK,
isXMLName,
putIdentifier,
removeIdentifier,
setErrorChecking,
setEventListeners,
setMutationEvents,
setUserData |
Methods inherited from class org.apache.xerces.dom.ParentNode |
setReadOnly,
synchronizeChildren,
synchronizeChildren |
Methods inherited from class org.apache.xerces.dom.NodeImpl |
addEventListener,
dispatchEvent,
getAttributes,
getLocalName,
getNamespaceURI,
getNextSibling,
getNodeValue,
getParentNode,
getPrefix,
getPreviousSibling,
getReadOnly,
getUserData,
hasAttributes,
removeEventListener,
setPrefix,
setUserData,
supports,
synchronizeData,
toString |
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
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()
Document.getDocumentElement()
public DOMImplementation getImplementation()
DOMImplementation
object that handles this document.
A DOM application may use objects from multiple implementations.Document#DOMImplementation
protected final void enterExpansion()
protected final void leaveExpansion()
public final LazyNode getNodeById(int nodeId)
public final LazyNode getNodeFromTemplate(LazyNode template)
getNodeById
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)
parentNode
returns null
.).
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 any other type of node simply
returns a copy of this node.
EntityReference
clone are readonly.Node.cloneNode(boolean)
public void makeTemplateNode(int nodeId)
public int getNodeId()
LazyNode.getNodeId()
public boolean isTemplateNode()
LazyNode.isTemplateNode()
public LazyNode getTemplateNode()
LazyNode.getTemplateNode()
public LazyNode templateClone(Document ownerDocument)
LazyNode.templateClone(org.w3c.dom.Document)
public void setNodeValue(java.lang.String value)
org.w3c.dom.Node.setNodeValue
public boolean isParentExpanded()
LazyParent.isParentExpanded()
public void setParentExpanded()
LazyParent.setParentExpanded()
public void setParentWhileExpanding(Node parent)
LazyParent.setParentWhileExpanding(org.w3c.dom.Node)
public boolean areChildrenExpanded()
LazyParent.areChildrenExpanded()
public void setChildrenExpanded()
LazyParent.setChildrenExpanded()
public void appendChildWhileExpanding(Node child)
LazyParent.appendChildWhileExpanding(org.w3c.dom.Node)
public NodeList getChildNodes()
NodeList
that contains all children of this node. If
there are no children, this is a NodeList
containing no
nodes. The content of the returned NodeList
is "live" in
the sense that, for instance, changes to the children of the node
object that it was created from are immediately reflected in the nodes
returned by the NodeList
accessors; it is not a static
snapshot of the content of the node. This is true for every
NodeList
, including the ones returned by the
getElementsByTagName
method.Node.getChildNodes()
public Node getFirstChild()
null
.Node.getFirstChild()
public Node getLastChild()
null
.Node.getLastChild()
public Node insertBefore(Node newChild, Node refChild) throws DOMException
newChild
before the existing child node
refChild
. If refChild
is null
, insert newChild
at the end of the list of children.
newChild
is a DocumentFragment
object, all of its children are inserted, in the same order, before
refChild
. If the newChild
is already in the
tree, it is first removed.Node.insertBefore(org.w3c.dom.Node, org.w3c.dom.Node)
public Node replaceChild(Node newChild, Node oldChild) throws DOMException
oldChild
with
newChild
in the list of children, and returns the
oldChild
node.
newChild
is a DocumentFragment
object,
oldChild
is replaced by all of the
DocumentFragment
children, which are inserted in the same
order. If the newChild
is already in the tree, it is
first removed.Node.replaceChild(org.w3c.dom.Node, org.w3c.dom.Node)
public Node removeChild(Node oldChild) throws DOMException
oldChild
from the
list of children, and returns it.Node.removeChild(org.w3c.dom.Node)
public Node appendChild(Node newChild) throws DOMException
newChild
to the end of the list of children
of this node. If the newChild
is already in the tree, it
is first removed.Node.appendChild(org.w3c.dom.Node)
public boolean hasChildNodes()
Node.hasChildNodes()
public void normalize()
Text
nodes in the full depth of the sub-tree
underneath this Node
, including attribute nodes, into a
"normal" form where only markup (e.g., tags, comments, processing
instructions, CDATA sections, and entity references) separates
Text
nodes, i.e., there are neither adjacent
Text
nodes nor empty Text
nodes. This can be
used to ensure that the DOM view of a document is the same as if it
were saved and re-loaded, and is useful when operations (such as
XPointer lookups) that depend on a particular document tree structure
are to be used. In cases where the document contains
CDATASections
, the normalize operation alone may not be
sufficient, since XPointers do not differentiate between
Text
nodes and CDATASection
nodes.Node.normalize()
public DocumentType getDoctype()
DocumentType
)
associated with this document. For HTML documents as well as XML
documents without a document type declaration this returns
null
. The DOM Level 2 does not support editing the
Document Type Declaration, therefore docType
cannot be
altered in any way, including through the use of methods, such as
insertNode
or removeNode
, inherited from
Node
.Document.getDoctype()
public Element createElement(java.lang.String tagName) throws DOMException
Element
interface, so attributes
can be specified directly on the returned object.
Attr
nodes representing them are automatically created and
attached to the element.
createElementNS
method.Document.createElement(java.lang.String)
public Text createTextNode(java.lang.String data)
Text
node given the specified string.Document.createTextNode(java.lang.String)
public Comment createComment(java.lang.String data)
Comment
node given the specified string.Document.createComment(java.lang.String)
public CDATASection createCDATASection(java.lang.String data) throws DOMException
CDATASection
node whose value is the specified
string.Document.createCDATASection(java.lang.String)
public ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
ProcessingInstruction
node given the specified
name and data strings.Document.createProcessingInstruction(java.lang.String, java.lang.String)
public Attr createAttribute(java.lang.String name) throws DOMException
Attr
of the given name. Note that the
Attr
instance can then be set on an Element
using the setAttribute
method.
createAttributeNS
method.Document.createAttribute(java.lang.String)
public Notation createNotation(java.lang.String name) throws DOMException
org.w3c.dom.Document#createNotation
public EntityReference createEntityReference(java.lang.String name) throws DOMException
EntityReference
object. In addition, if the
referenced entity is known, the child list of the
EntityReference
node is made the same as that of the
corresponding Entity
node. If any descendant of the
Entity
node has an unbound namespace prefix , the
corresponding descendant of the created EntityReference
node is also unbound; (its namespaceURI
is
null
). The DOM Level 2 does not support any mechanism to
resolve namespace prefixes.Document.createEntityReference(java.lang.String)
public Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
Document.createElementNS(java.lang.String, java.lang.String)
public Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName) throws DOMException
Document.createAttributeNS(java.lang.String, java.lang.String)
public DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID, java.lang.String internalSubset) throws DOMException
DocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID) throws DOMException
DocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public Entity createEntity(java.lang.String name) throws DOMException
DocumentImpl.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
org.w3c.dom.Document#createNotation
public LazyEntityReference createEntityReference(int nodeId) throws DOMException
Document.createEntityReference(java.lang.String)
public LazyDocumentType createDocumentType(int nodeId) throws DOMException
DocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public LazyEntity createEntity(int nodeId) throws DOMException
DocumentImpl.createEntity(java.lang.String)
public LazyElement createTemplateElement(java.lang.String tagName, int nodeId, java.lang.String preFormattedText) throws DOMException
createElement(String)
,
Document.createElement(java.lang.String)
public LazyText createTemplateTextNode(java.lang.String data, int nodeId, java.lang.String preFormattedText)
#createText(String)
,
Document.createTextNode(java.lang.String)
public LazyComment createTemplateComment(java.lang.String data, int nodeId)
createComment(String)
,
Document.createComment(java.lang.String)
public LazyCDATASection createTemplateCDATASection(java.lang.String data, int nodeId) throws DOMException
#createCDataSection(String)
,
Document.createCDATASection(java.lang.String)
public LazyProcessingInstruction createTemplateProcessingInstruction(java.lang.String target, java.lang.String data, int nodeId)
createProcessingInstruction(String,String)
,
Document.createProcessingInstruction(java.lang.String, java.lang.String)
public LazyAttr createTemplateAttribute(java.lang.String name, int nodeId) throws DOMException
createAttribute(String)
,
Document.createAttribute(java.lang.String)
public LazyAttr createTemplateAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, int nodeId) throws DOMException
createAttributeNS(String,String)
,
Document.createAttributeNS(java.lang.String, java.lang.String)
public LazyNotation createTemplateNotation(java.lang.String name, int nodeId) throws DOMException
createNotation(String)
,
org.w3c.dom.Document#createNotation
public LazyEntityReference createTemplateEntityReference(java.lang.String name, int nodeId) throws DOMException
createEntityReference(String)
,
Document.createEntityReference(java.lang.String)
public LazyElement createTemplateElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName, int nodeId, java.lang.String preFormattedText) throws DOMException
createElementNS(String,String)
,
Document.createElementNS(java.lang.String, java.lang.String)
public LazyAttr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName, int nodeId) throws DOMException
createAttributeNS(String,String)
,
Document.createAttributeNS(java.lang.String, java.lang.String)
public LazyDocumentType createTemplateDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID, java.lang.String internalSubset, int nodeId) throws DOMException
createDocumentType(String,String,String,String)
,
DocumentImpl.createDocumentType(java.lang.String, java.lang.String, java.lang.String)
public LazyEntity createTemplateEntity(java.lang.String name, java.lang.String publicId, java.lang.String systemId, java.lang.String notationName, int nodeId) throws DOMException
createEntity(String)
,
DocumentImpl.createEntity(java.lang.String)
public void setPreFormatOutputOptions(OutputOptions outputOptions)
outputOptions
- The output options; should be read-only.public OutputOptions getPreFormatOutputOptions()
PreFormattedTextDocument.getPreFormatOutputOptions()
public void setXMLObject(XMLObject xmlObject)
XMLObjectLink.setXMLObject(org.enhydra.xml.xmlc.XMLObject)
public XMLObject getXMLObject()
XMLObjectLink.getXMLObject()
|
Enhydra 3.1.1b1 API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |