org.apache.xalan.stree
Class DocumentImpl

java.lang.Object
  |
  +--org.apache.xml.utils.UnImplNode
        |
        +--org.apache.xalan.stree.Child
              |
              +--org.apache.xalan.stree.Parent
                    |
                    +--org.apache.xalan.stree.DocImpl
                          |
                          +--org.apache.xalan.stree.DocumentImpl
Direct Known Subclasses:
DocumentFragmentImpl

public class DocumentImpl
extends DocImpl

**For internal use only** This is the implementation of the DOM2 Document interface. It rules over the tree, and may contain common information for the tree.


Fields inherited from class org.apache.xalan.stree.DocImpl
m_exceptionThrown
 
Constructor Summary
DocumentImpl(int charBufSize)
          Constructor DocumentImpl
 
Method Summary
 Node appendChild(Node newChild)
          Append a child to the child list.
 Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Unimplemented right now.
 CDATASection createCDATASection(java.lang.String data)
          Create a CDATASection node.
 Comment createComment(java.lang.String data)
          Create a Comment node.
 DocumentFragment createDocumentFragment()
          Create a DocumentFragment.
 Element createElement(java.lang.String tagName)
          Create a new Element.
 Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
          Create a new namespaced element.
 ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
          Create a ProcessingInstruction node.
 Text createTextNode(java.lang.String data)
          Create a Text node.
 DocumentType getDoctype()
          For XML, this provides access to the Document Type Definition.
 Element getDocumentElement()
          Convenience method, allowing direct access to the child node which is considered the root of the actual document content.
 Element getElementById(java.lang.String elementId)
          Given an ID, return the element.
 java.util.Hashtable getIDAttributes()
          Get the table that holds the ID string to node associations, for looking up XML IDs.
 java.lang.String getLocalName()
          Returns the local part of the qualified name of this node.
 Node getNextSibling()
          The node immediately following this node.
 java.lang.String getNodeName()
          Returns the node name.
 short getNodeType()
          Returns the node type.
 Node importNode(Node importedNode, boolean deep)
          Unimplemented, since this a read-only DOM.
 void setDoctype(DocumentType docType)
           
 void setIDAttribute(java.lang.String id, Element elem)
          Set an ID string to node association in the ID table.
 
Methods inherited from class org.apache.xalan.stree.DocImpl
getUseMultiThreading, setUseMultiThreading
 
Methods inherited from class org.apache.xalan.stree.Parent
dispatchCharactersEvent, getChild, getChildCount, getChildUID, getFirstChild, getLastChild, hasChildNodes, isComplete, setComplete
 
Methods inherited from class org.apache.xalan.stree.Child
getAttributes, getLevel, getNamespaceURI, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getTagName, getUid, isNamespaceNode, isSupported, setAttribute, setLevel
 
Methods inherited from class org.apache.xml.utils.UnImplNode
appendData, cloneNode, createAttribute, createEntityReference, deleteData, error, error, getAttribute, getAttributeNode, getAttributeNodeNS, getAttributeNS, getChildNodes, getElementsByTagName, getElementsByTagNameNS, getImplementation, getLength, getNodeValue, getOwnerElement, getSpecified, hasAttribute, hasAttributeNS, hasAttributes, insertBefore, insertData, item, normalize, removeAttribute, removeAttributeNode, removeAttributeNS, removeChild, replaceChild, replaceData, setAttributeNode, setAttributeNodeNS, setAttributeNS, setData, setNodeValue, setPrefix, setValue, splitText, substringData
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentImpl

public DocumentImpl(int charBufSize)
Constructor DocumentImpl
Method Detail

getDoctype

public DocumentType getDoctype()
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.
Returns:
The DocumentType reference, which may well be null.
Overrides:
getDoctype in class UnImplNode

setDoctype

public void setDoctype(DocumentType docType)

getDocumentElement

public Element getDocumentElement()
Convenience method, allowing direct access to the child node which is considered the root of the actual document content.
Returns:
the document element, which may be null if it hasn't been constructed.
Overrides:
getDocumentElement in class UnImplNode

getIDAttributes

public java.util.Hashtable getIDAttributes()
Get the table that holds the ID string to node associations, for looking up XML IDs.
Returns:
the ID table, never null.

setIDAttribute

public void setIDAttribute(java.lang.String id,
                           Element elem)
Set an ID string to node association in the ID table.
Parameters:
id - The ID string.
elem - The associated ID.

appendChild

public Node appendChild(Node newChild)
                 throws DOMException
Append a child to the child list.
Parameters:
newChild - Must be a org.apache.xalan.stree.Child.
Returns:
The child that was added.
Throws:
java.lang.ClassCastException - if the newChild isn't a org.apache.xalan.stree.Child.
DOMException -  
Overrides:
appendChild in class Parent

getNodeType

public short getNodeType()
Returns the node type.
Returns:
Node.DOCUMENT_NODE.
Overrides:
getNodeType in class UnImplNode

getNodeName

public java.lang.String getNodeName()
Returns the node name.
Returns:
"#document" string.
Overrides:
getNodeName in class UnImplNode

getLocalName

public java.lang.String getLocalName()
Returns the local part of the qualified name of this node.
For nodes created with a DOM Level 1 method, such as createElement from the Document interface, it is null.
Returns:
The local name of the node, or null if namespaces are not processed.
Overrides:
getLocalName in class Child
Since:
DOM Level 2

createElement

public Element createElement(java.lang.String tagName)
                      throws DOMException
Create a new Element.
Parameters:
tagName - The name of the element.
Returns:
A new element.
Throws:
DOMException -  
Overrides:
createElement in class UnImplNode

createDocumentFragment

public DocumentFragment createDocumentFragment()
Create a DocumentFragment.
Returns:
a new DocumentFragment reference.
Overrides:
createDocumentFragment in class UnImplNode

createTextNode

public Text createTextNode(java.lang.String data)
Create a Text node.
Parameters:
data - The character that this node holds.
Returns:
A new Text node.
Overrides:
createTextNode in class UnImplNode

createComment

public Comment createComment(java.lang.String data)
Create a Comment node.
Parameters:
data - The comment data that this node holds.
Returns:
A new Comment node.
Overrides:
createComment in class UnImplNode

createCDATASection

public CDATASection createCDATASection(java.lang.String data)
                                throws DOMException
Create a CDATASection node.
Parameters:
data - The character data that this node holds.
Returns:
A new CDATASection node.
Throws:
DOMException -  
Overrides:
createCDATASection in class UnImplNode

createProcessingInstruction

public ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                         java.lang.String data)
                                                  throws DOMException
Create a ProcessingInstruction node.
Parameters:
target - The name of the PI.
data - The data for this PI.
Returns:
A new ProcessingInstruction node.
Throws:
DOMException -  
Overrides:
createProcessingInstruction in class UnImplNode

importNode

public Node importNode(Node importedNode,
                       boolean deep)
                throws DOMException
Unimplemented, since this a read-only DOM.
Parameters:
importedNode - The node being imported.
deep - Tells if we should also import the subtree.
Returns:
A new node of the same type as importedNode.
Throws:
DOMException -  
Overrides:
importNode in class UnImplNode

createElementNS

public Element createElementNS(java.lang.String namespaceURI,
                               java.lang.String qualifiedName)
                        throws DOMException
Create a new namespaced element.
Parameters:
namespaceURI - The namespace URI (NEEDTOREVIEW: Handling of "" vs. null. -sb)
qualifiedName - The qualified name of the element type to instantiate.
Returns:
A new Element object with the following attributes: Attribute ValueNode.nodeName qualifiedNameNode.namespaceURI namespaceURINode.prefix prefix, extracted from qualifiedName , or null if there is no prefixNode.localName local name , extracted from qualifiedNameElement.tagName qualifiedName
Throws:
DOMException -  
Overrides:
createElementNS in class UnImplNode

createAttributeNS

public Attr createAttributeNS(java.lang.String namespaceURI,
                              java.lang.String qualifiedName)
                       throws DOMException
Unimplemented right now.
Parameters:
namespaceURI - The namespace URI of the attribute to create.
qualifiedName - The qualified name of the attribute to instantiate.
Returns:
A new Attr object with the following attributes: Attribute ValueNode.nodeName qualifiedName Node.namespaceURInamespaceURI Node.prefix prefix, extracted from qualifiedName , or null if there is no prefixNode.localName local name , extracted from qualifiedNameAttr.name qualifiedName
Throws:
DOMException -  
Overrides:
createAttributeNS in class UnImplNode

getElementById

public Element getElementById(java.lang.String elementId)
Given an ID, return the element.
Parameters:
elementId - A non-null string that may be a key in the ID table.
Returns:
The element associated with the given elementId, or null if not found.
Overrides:
getElementById in class UnImplNode

getNextSibling

public Node getNextSibling()
The node immediately following this node. If there is no such node, this returns null.
Returns:
Always null, since there is never a node following a Document node.
Overrides:
getNextSibling in class Child


Copyright � 2000 Apache XML Project. All Rights Reserved.