Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.xml.lazydom
Class LazyDocument  view LazyDocument download LazyDocument.java

java.lang.Object
  extended byorg.apache.xerces.dom.NodeImpl
      extended byorg.apache.xerces.dom.ChildNode
          extended byorg.apache.xerces.dom.ParentNode
              extended byorg.apache.xerces.dom.CoreDocumentImpl
                  extended byorg.apache.xerces.dom.DocumentImpl
                      extended byorg.enhydra.xml.lazydom.LazyDocument
All Implemented Interfaces:
java.lang.Cloneable, org.w3c.dom.Document, org.w3c.dom.events.DocumentEvent, org.w3c.dom.ranges.DocumentRange, org.w3c.dom.traversal.DocumentTraversal, org.w3c.dom.events.EventTarget, LazyNode, LazyParent, org.w3c.dom.Node, org.w3c.dom.NodeList, org.enhydra.xml.io.PreFormattedTextDocument, java.io.Serializable

public class LazyDocument
extends org.apache.xerces.dom.DocumentImpl
implements LazyParent, org.enhydra.xml.io.PreFormattedTextDocument

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:

This coarse-grained locking approach minimizes the number of locks * on the assumption that collisions do not occur frequently

To created an extended DOM, one must override both the factory methods that take strings and those that take node ids.


Nested Class Summary
 
Nested classes inherited from class org.apache.xerces.dom.DocumentImpl
 
Nested classes inherited from class org.apache.xerces.dom.CoreDocumentImpl
 
Field Summary
private  boolean fChildrenExpanded
          Children expanded flag.
private  boolean fDocTypeExpanded
          Has the DocumentType been expanded?
private  LazyNode[] fExpandedNodes
          Table of LazyNodes that have already been expanded, indexed by nodeId.
private  boolean fExpanding
          Detection of recursive calls of one of the expansion routines.
private  boolean fExpandingDocType
          Detection of recursive calls of doctype expansion.
private  boolean fIsTemplateNode
          Is this a template node?
private  int fNodeId
           
private  org.enhydra.xml.io.OutputOptions fPreFormatOutputOptions
          OutputOptions used for creating the preformatted text.
private  TemplateDOM fTemplateDOM
          Template document DOM.
private  LazyDocument fTemplateNode
          Template for this Document.
 
Fields inherited from class org.apache.xerces.dom.DocumentImpl
eventListeners, iterators, mutationEvents, ranges
 
Fields inherited from class org.apache.xerces.dom.CoreDocumentImpl
actualEncoding, allowGrammarAccess, changes, docElement, docType, encoding, errorChecking, fDocumentURI, identifiers, standalone, userData, version, xmlVersionChanged
 
Fields inherited from class org.apache.xerces.dom.ParentNode
firstChild, fNodeListCache, ownerDocument
 
Fields inherited from class org.apache.xerces.dom.ChildNode
nextSibling, previousSibling
 
Fields inherited from class org.apache.xerces.dom.NodeImpl
DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_IS_CONTAINED, DOCUMENT_POSITION_PRECEDING, ELEMENT_DEFINITION_NODE, FIRSTCHILD, flags, HASSTRING, ID, IGNORABLEWS, NORMALIZED, OWNED, ownerNode, READONLY, SPECIFIED, SYNCCHILDREN, SYNCDATA, TREE_POSITION_ANCESTOR, TREE_POSITION_DESCENDANT, TREE_POSITION_DISCONNECTED, TREE_POSITION_EQUIVALENT, TREE_POSITION_FOLLOWING, TREE_POSITION_PRECEDING, TREE_POSITION_SAME_NODE
 
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(org.w3c.dom.DocumentType documentType, TemplateDOM templateDOM)
          Constructor.
 
Method Summary
 org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
          Adds the node newChild to the end of the list of children of this node.
 void appendChildWhileExpanding(org.w3c.dom.Node child)
          Append a child during node expansion.
 boolean areChildrenExpanded()
          Are the children of this node expanded?
 org.w3c.dom.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.
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Factory method; creates an Attribute having this Document as its OwnerDoc.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Introduced in DOM Level 2.
 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.
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
          Factory method; creates a CDATASection having this Document as its OwnerDoc.
 LazyComment createComment(int nodeId)
          Create a comment from a template given its id.
 org.w3c.dom.Comment createComment(java.lang.String data)
          Factory method; creates a Comment having this Document as its OwnerDoc.
 LazyDocumentType createDocumentType(int nodeId)
          Create a new DocumentType object (Non-DOM).
 org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName, java.lang.String publicID, java.lang.String systemID)
          Create a new DocumentType object (Non-DOM).
 org.w3c.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.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Factory method; creates an Element having this Document as its OwnerDoc.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Introduced in DOM Level 2.
 LazyEntity createEntity(int nodeId)
          Create a new Entity object (Non-DOM).
 org.w3c.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.
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
          Factory method; creates an EntityReference having this Document as its OwnerDoc.
private  LazyNode createLazyNode(int nodeId)
          Create a new node from a template, placing it in the expanded table.
 LazyNotation createNotation(int nodeId)
          Create a notation node from a template given its id.
 org.w3c.dom.Notation createNotation(java.lang.String name)
          NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc.
 LazyProcessingInstruction createProcessingInstruction(int nodeId)
          Create a process instruction node from a template given its id.
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
          Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.
 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.
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Factory method; creates a Text node having this Document as its OwnerDoc.
protected  void doExpandChildren(LazyParent node)
          Do work of expanding the children of a node, if they are not already expanded.
private  void doExpandDocType()
          Expand the document type if needed.
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.
private  void expandChildren()
          Expand the children of this element, if they are not already expanded.
private  void expandNodeChildren(LazyParent node)
          Method to expand children of a node once synchronized and fExpanding is set.
private  void expandParent()
          Expand the parent of this element, if it is not already expanded.
 org.w3c.dom.NodeList getChildNodes()
          A NodeList that contains all children of this node.
 org.w3c.dom.DocumentType getDoctype()
          For XML, this provides access to the Document Type Definition.
 org.w3c.dom.Element getDocumentElement()
          Convenience method, allowing direct access to the child node which is considered the root of the actual document content.
 LazyNode getExpandedNode(int nodeId)
          Get a pointer to a node if its been expanded, otherwise return null.
 org.w3c.dom.Node getFirstChild()
          The first child of this node.
 org.w3c.dom.DOMImplementation getImplementation()
          Retrieve information describing the abilities of this particular DOM implementation.
 org.w3c.dom.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.
 org.enhydra.xml.io.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.
 boolean hasChildNodes()
          Returns whether this node has any children.
 org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild, org.w3c.dom.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 structure (e.g., elements, comments, processing instructions, CDATA sections, and entity references) separates Text nodes, i.e., there are neither adjacent Text nodes nor empty Text nodes.
 org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
          Removes the child node indicated by oldChild from the list of children, and returns it.
 org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild, org.w3c.dom.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(org.w3c.dom.Node parent)
          Set the parent of this node during expansion.
 void setPreFormatOutputOptions(org.enhydra.xml.io.OutputOptions outputOptions)
          Set the output options that were used to preformat this document.
 LazyNode templateClone(org.w3c.dom.Document ownerDocument)
          Create a new node, using this node as the template.
 
Methods inherited from class org.apache.xerces.dom.DocumentImpl
addEventListener, copyEventListeners, createEvent, createNodeIterator, createNodeIterator, createRange, createTreeWalker, createTreeWalker, dispatchAggregateEvents, dispatchAggregateEvents, dispatchEvent, dispatchEventToSubtree, getEventListeners, removeEventListener, saveEnclosingAttr, setEventListeners
 
Methods inherited from class org.apache.xerces.dom.CoreDocumentImpl
abort, adoptNode, changed, changes, checkDOMNSErr, checkNamespaceWF, checkQName, clearIdentifiers, clone, cloneNode, createAttributeNS, createDocumentFragment, createElementDefinition, createElementNS, getAsync, getBaseURI, getDocumentURI, getDomConfig, getElementById, getElementsByTagName, getElementsByTagNameNS, getErrorChecking, getFeature, getIdentifier, getIdentifiers, getInputEncoding, getNodeName, getNodeNumber, getNodeNumber, getNodeType, getOwnerDocument, getStrictErrorChecking, getTextContent, getUserData, getUserData, getXmlEncoding, getXmlStandalone, getXmlVersion, importNode, isKidOK, isValidQName, isXMLName, load, loadXML, normalizeDocument, putIdentifier, removeIdentifier, renameNode, saveXML, setAsync, setDocumentURI, setErrorChecking, setInputEncoding, setStrictErrorChecking, setTextContent, setUserData, setUserData, setXmlEncoding, setXmlStandalone, setXmlVersion
 
Methods inherited from class org.apache.xerces.dom.ParentNode
getChildNodesUnoptimized, getLength, isEqualNode, item, setReadOnly, synchronizeChildren
 
Methods inherited from class org.apache.xerces.dom.ChildNode
getNextSibling, getParentNode, getPreviousSibling
 
Methods inherited from class org.apache.xerces.dom.NodeImpl
addEventListener, compareDocumentPosition, compareTreePosition, dispatchEvent, getAttributes, getContainer, getLocalName, getNamespaceURI, getNodeValue, getPrefix, getReadOnly, getUserData, getUserData, hasAttributes, isDefaultNamespace, isSameNode, isSupported, lookupNamespaceURI, lookupPrefix, needsSyncChildren, removeEventListener, setPrefix, 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
getAttributes, getLocalName, getNamespaceURI, getNextSibling, getNodeName, getNodeType, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, isSupported, setPrefix
 

Field Detail

fTemplateDOM

private TemplateDOM fTemplateDOM
Template document DOM. This is shared by all instances and must not be modified.


fExpandedNodes

private LazyNode[] fExpandedNodes
Table of LazyNodes that have already been expanded, indexed by nodeId. Entry is null if the node has not been expanded.


fExpanding

private boolean fExpanding
Detection of recursive calls of one of the expansion routines.


fDocTypeExpanded

private boolean fDocTypeExpanded
Has the DocumentType been expanded?


fExpandingDocType

private boolean fExpandingDocType
Detection of recursive calls of doctype expansion. A seperate flag, since doctype maybe expanded while expanding attributes.


fTemplateNode

private LazyDocument fTemplateNode
Template for this Document.


fNodeId

private int fNodeId

fIsTemplateNode

private boolean fIsTemplateNode
Is this a template node?


fChildrenExpanded

private boolean fChildrenExpanded
Children expanded flag. NB: code is special, since there is node parent.


fPreFormatOutputOptions

private org.enhydra.xml.io.OutputOptions fPreFormatOutputOptions
OutputOptions used for creating the preformatted text.

Constructor Detail

LazyDocument

public LazyDocument(org.w3c.dom.DocumentType documentType,
                    TemplateDOM templateDOM)
Constructor.


LazyDocument

public LazyDocument()
Constructor with no argument, for LazyHTMLDocument.

Method Detail

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Convenience method, allowing direct access to the child node which is considered the root of the actual document content. For HTML, where it is legal to have more than one Element at the top level of the document, we pick the one with the tagName "HTML". For XML there should be only one top-level (HTML not yet supported.)

Specified by:
getDocumentElement in interface org.w3c.dom.Document

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
Description copied from class: org.apache.xerces.dom.DocumentImpl
Retrieve information describing the abilities of this particular DOM implementation. Intended to support applications that may be using DOMs retrieved from several different sources, potentially with different underlying representations.

Specified by:
getImplementation in interface org.w3c.dom.Document

enterExpansion

protected final void enterExpansion()
Flag that an expansion is in progress, which is used to detect recursion. MUST be synchronized on document.


leaveExpansion

protected final void leaveExpansion()
Flag that an expansion is complete. MUST be synchronized on document.


createLazyNode

private LazyNode createLazyNode(int nodeId)
Create a new node from a template, placing it in the expanded table. Uses factory methods so that derived document can override node type. MUST be synchronized on document.


getNodeById

public final LazyNode getNodeById(int nodeId)
Get or create a lazy node, given its id. Expanding if it doesn't exist. All node creation must go through here so that a derived document create factory is used.


getNodeFromTemplate

public final LazyNode getNodeFromTemplate(LazyNode template)
Get or create a node given, the template node.


expandNodeChildren

private void expandNodeChildren(LazyParent node)
Method to expand children of a node once synchronized and fExpanding is set. MUST be synchronized on document.


doExpandParent

protected void doExpandParent(LazyParent node)
Do work of expanding the parent of a node, if it is not already expanded. This also expands the children, as this keeps the expansion bookkeeping simple and getting a parent not a common operation except to access a sibling or add a new sibling Only used internally to this package.


doExpandChildren

protected void doExpandChildren(LazyParent node)
Do work of expanding the children of a node, if they are not already expanded. Only lazy parent's have a flag for siblings, as data nodes can never be accessed without going through the parent and expanding the children. Only used internally to this package.


getExpandedNode

public final LazyNode getExpandedNode(int nodeId)
Get a pointer to a node if its been expanded, otherwise return null.


getTemplateNode

public final LazyNode getTemplateNode(int nodeId)
Get a template node, given a node id.


isDocTypeExpanded

public boolean isDocTypeExpanded()
Has the DocumentType been expanded?


getTemplateDocument

public LazyDocument getTemplateDocument()
Get the template for this node.


cloneNode

public org.w3c.dom.Node cloneNode(boolean deep)
Description copied from interface: org.w3c.dom.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 org.w3c.dom.Node

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

isTemplateNode

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

Specified by:
isTemplateNode in interface LazyNode

getTemplateNode

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

Specified by:
getTemplateNode in interface LazyNode

templateClone

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

Specified by:
templateClone in interface LazyNode

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 org.w3c.dom.Node

isParentExpanded

public boolean isParentExpanded()
Description copied from interface: LazyParent
Is the parent of this node expanded?

Specified by:
isParentExpanded in interface LazyParent

setParentExpanded

public void setParentExpanded()
Description copied from interface: LazyParent
Flag the parent as being expanded.

Specified by:
setParentExpanded in interface LazyParent

setParentWhileExpanding

public void setParentWhileExpanding(org.w3c.dom.Node parent)
Description copied from interface: LazyParent
Set the parent of this node during expansion. This should also flag the parent as being expanded.

Specified by:
setParentWhileExpanding in interface LazyParent

areChildrenExpanded

public boolean areChildrenExpanded()
Description copied from interface: LazyParent
Are the children of this node expanded?

Specified by:
areChildrenExpanded in interface LazyParent

setChildrenExpanded

public void setChildrenExpanded()
Description copied from interface: LazyParent
Flag the children as being expanded.

Specified by:
setChildrenExpanded in interface LazyParent

appendChildWhileExpanding

public void appendChildWhileExpanding(org.w3c.dom.Node child)
Description copied from interface: LazyParent
Append a child during node expansion. This should only add the child, not trigger any other expansion.

Specified by:
appendChildWhileExpanding in interface LazyParent

expandParent

private void expandParent()
Expand the parent of this element, if it is not already expanded.


expandChildren

private void expandChildren()
Expand the children of this element, if they are not already expanded.


getChildNodes

public org.w3c.dom.NodeList getChildNodes()
Description copied from interface: org.w3c.dom.Node
A NodeList that contains all children of this node. If there are no children, this is a NodeList containing no nodes.

Specified by:
getChildNodes in interface org.w3c.dom.Node

getFirstChild

public org.w3c.dom.Node getFirstChild()
Description copied from interface: org.w3c.dom.Node
The first child of this node. If there is no such node, this returns null.

Specified by:
getFirstChild in interface org.w3c.dom.Node

getLastChild

public org.w3c.dom.Node getLastChild()
Description copied from interface: org.w3c.dom.Node
The last child of this node. If there is no such node, this returns null.

Specified by:
getLastChild in interface org.w3c.dom.Node

insertBefore

public org.w3c.dom.Node insertBefore(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node refChild)
                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Inserts the node newChild before the existing child node refChild. If refChild is null, insert newChild at the end of the list of children.
If 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.

Specified by:
insertBefore in interface org.w3c.dom.Node

replaceChild

public org.w3c.dom.Node replaceChild(org.w3c.dom.Node newChild,
                                     org.w3c.dom.Node oldChild)
                              throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Replaces the child node oldChild with newChild in the list of children, and returns the oldChild node.
If 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.

Specified by:
replaceChild in interface org.w3c.dom.Node

removeChild

public org.w3c.dom.Node removeChild(org.w3c.dom.Node oldChild)
                             throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Removes the child node indicated by oldChild from the list of children, and returns it.

Specified by:
removeChild in interface org.w3c.dom.Node

appendChild

public org.w3c.dom.Node appendChild(org.w3c.dom.Node newChild)
                             throws org.w3c.dom.DOMException
Description copied from interface: org.w3c.dom.Node
Adds the node newChild to the end of the list of children of this node. If the newChild is already in the tree, it is first removed.

Specified by:
appendChild in interface org.w3c.dom.Node

hasChildNodes

public boolean hasChildNodes()
Description copied from interface: org.w3c.dom.Node
Returns whether this node has any children.

Specified by:
hasChildNodes in interface org.w3c.dom.Node

normalize

public void normalize()
Description copied from interface: org.w3c.dom.Node
Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (e.g., elements, 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.

Specified by:
normalize in interface org.w3c.dom.Node

doExpandDocType

private void doExpandDocType()
Expand the document type if needed.


getDoctype

public org.w3c.dom.DocumentType getDoctype()
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
For XML, this provides access to the Document Type Definition. For HTML documents, and XML documents which don't specify a DTD, it will be null.

Specified by:
getDoctype in interface org.w3c.dom.Document

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates an Element having this Document as its OwnerDoc.

Specified by:
createElement in interface org.w3c.dom.Document

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates a Text node having this Document as its OwnerDoc.

Specified by:
createTextNode in interface org.w3c.dom.Document

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates a Comment having this Document as its OwnerDoc.

Specified by:
createComment in interface org.w3c.dom.Document

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates a CDATASection having this Document as its OwnerDoc.

Specified by:
createCDATASection in interface org.w3c.dom.Document

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates a ProcessingInstruction having this Document as its OwnerDoc.

Specified by:
createProcessingInstruction in interface org.w3c.dom.Document

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates an Attribute having this Document as its OwnerDoc.

Specified by:
createAttribute in interface org.w3c.dom.Document

createNotation

public org.w3c.dom.Notation createNotation(java.lang.String name)
                                    throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
NON-DOM Factory method; creates a Notation having this Document as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD information unspecified.)


createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Factory method; creates an EntityReference having this Document as its OwnerDoc.

Specified by:
createEntityReference in interface org.w3c.dom.Document

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
                                    throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Introduced in DOM Level 2.

Creates an element of the given qualified name and namespace URI. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the created element is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces].

Specified by:
createElementNS in interface org.w3c.dom.Document

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
                                   throws org.w3c.dom.DOMException
Description copied from class: org.apache.xerces.dom.CoreDocumentImpl
Introduced in DOM Level 2.

Creates an attribute of the given qualified name and namespace URI. If the given namespaceURI is null or an empty string and the qualifiedName has a prefix that is "xml", the created element is bound to the predefined namespace "http://www.w3.org/XML/1998/namespace" [Namespaces].

Specified by:
createAttributeNS in interface org.w3c.dom.Document

createDocumentType

public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName,
                                                   java.lang.String publicID,
                                                   java.lang.String systemID,
                                                   java.lang.String internalSubset)
                                            throws org.w3c.dom.DOMException
Create a new DocumentType object (Non-DOM).


createDocumentType

public org.w3c.dom.DocumentType createDocumentType(java.lang.String qualifiedName,
                                                   java.lang.String publicID,
                                                   java.lang.String systemID)
                                            throws org.w3c.dom.DOMException
Create a new DocumentType object (Non-DOM). This overrides the method in the Xerces DOM used by importNode().


createEntity

public org.w3c.dom.Entity createEntity(java.lang.String name)
                                throws org.w3c.dom.DOMException
Create a new Entity object (Non-DOM).


createElement

public LazyElement createElement(int nodeId)
                          throws org.w3c.dom.DOMException
Create a element from a template given its id.


createTextNode

public LazyText createTextNode(int nodeId)
Create a text node from a template given its id.


createComment

public LazyComment createComment(int nodeId)
Create a comment from a template given its id.


createCDATASection

public LazyCDATASection createCDATASection(int nodeId)
                                    throws org.w3c.dom.DOMException
Create a CDATASection from a template given its id.


createProcessingInstruction

public LazyProcessingInstruction createProcessingInstruction(int nodeId)
Create a process instruction node from a template given its id.


createAttribute

public LazyAttr createAttribute(int nodeId)
                         throws org.w3c.dom.DOMException
Create an attribute from a template given its id.


createNotation

public LazyNotation createNotation(int nodeId)
                            throws org.w3c.dom.DOMException
Create a notation node from a template given it