Xindice API

org.apache.xindice.xml.dom
Class DocumentImpl

java.lang.Object
  |
  +--org.apache.xindice.xml.dom.NodeImpl
        |
        +--org.apache.xindice.xml.dom.ContainerNodeImpl
              |
              +--org.apache.xindice.xml.dom.DocumentImpl
All Implemented Interfaces:
CompressedDocument, CompressedNode, DBDocument, DBNode, org.w3c.dom.Document, org.w3c.dom.traversal.DocumentTraversal, org.w3c.dom.Node

public final class DocumentImpl
extends ContainerNodeImpl
implements CompressedDocument, DBDocument, org.w3c.dom.traversal.DocumentTraversal

DocumentImpl


Fields inherited from class org.apache.xindice.xml.dom.NodeImpl
EX_DOMSTRING_SIZE, EX_HIERARCHY_REQUEST, EX_INDEX_SIZE, EX_INUSE_ATTRIBUTE, EX_INVALID_STATE, EX_NO_DATA_ALLOWED, EX_NO_MODIFICATION_ALLOWED, EX_NOT_FOUND, EX_WRONG_DOCUMENT, OBJECT_HREF, OBJECT_NS, OBJECT_TYPE, TYPE_APPEND, TYPE_CONTENT, TYPE_INSERT, TYPE_REPLACE, XMLNS_PREFIX
 
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
 
Fields inherited from interface org.apache.xindice.xml.dom.DBDocument
CACHE, CACHE_CONTROL, NOCACHE
 
Constructor Summary
DocumentImpl()
           
DocumentImpl(byte[] data)
           
DocumentImpl(byte[] data, int pos, int len)
           
DocumentImpl(byte[] data, SymbolTable symbols, NodeSource source)
           
DocumentImpl(org.w3c.dom.Document doc)
           
 
Method Summary
 org.w3c.dom.Node adoptNode(org.w3c.dom.Node src)
           
 org.w3c.dom.Attr createAttribute(java.lang.String name)
          Creates an Attr of the given name.
 org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
          Creates a CDATASection node whose value is the specified string.
 org.w3c.dom.Comment createComment(java.lang.String data)
          Creates a Comment node given the specified string.
 org.w3c.dom.DocumentFragment createDocumentFragment()
          Creates an empty DocumentFragment object.
 org.w3c.dom.Element createElement(java.lang.String tagName)
          Creates an element of the type specified.
 org.w3c.dom.Element createElementNS(java.lang.String namespaceURI, java.lang.String qualifiedName)
           
 org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
          Creates an EntityReference object.
 org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)
           
 org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target, java.lang.String data)
          Creates a ProcessingInstruction node given the specified name and data strings.
 org.w3c.dom.Text createTextNode(java.lang.String data)
          Creates a Text node given the specified string.
 org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root, int whatToShow, org.w3c.dom.traversal.NodeFilter filter, boolean entityReferenceExpansion)
           
 void expandSource()
          expandSource expands the source into the Node as a namespace and a set of attributes.
 java.lang.String getActualEncoding()
           
 org.w3c.dom.DocumentType getDoctype()
          The Document Type Declaration (see DocumentType) associated with this document.
 org.w3c.dom.Element getDocumentElement()
          This is a convenience attribute that allows direct access to the child node that is the root element of the document.
 java.lang.String getEncoding()
           
 org.w3c.dom.DOMImplementation getImplementation()
          The DOMImplementation object that handles this document.
 org.w3c.dom.Node getNodeAtPos(int pos)
          getNodeAtPos returns the Node that exists at the specified byte data position in the compressed stream.
 java.lang.String getNodeName()
          The name of this node, depending on its type; see the table above.
 short getNodeType()
          A code representing the type of the underlying object, as defined above.
 boolean getStandalone()
           
 boolean getStrictErrorChecking()
           
 SymbolTable getSymbols()
          getSymbols returns the Symbol table for this Document.
 java.lang.String getVersion()
           
 org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode, boolean deep)
           
 boolean isAuthoring()
          isAuthoring returns whether or not this Document is in an authoring mode.
 boolean isCaching()
          getCaching returns whether or not this Document should be cached by some sort of caching mechanism.
 boolean isReadOnly()
           
 void setActualEncoding(java.lang.String actualEncoding)
           
 void setAuthoring(boolean authoring)
          setAuthoring sets whether or not this Document is in an authoring mode.
 void setCaching(boolean caching)
          setCaching sets whether or not this Document should be cached by some sort of caching mechanism.
 void setDoctype(org.w3c.dom.DocumentType docType)
           
 void setEncoding(java.lang.String encoding)
           
 void setStandalone(boolean standalone)
           
 void setStrictErrorChecking(boolean strictErrorChecking)
           
 void setSymbols(SymbolTable symbols)
          setSymbols sets the Symbol table for this Document.
 void setVersion(java.lang.String version)
           
 
Methods inherited from class org.apache.xindice.xml.dom.ContainerNodeImpl
appendChild, getChildNodes, getElementById, getElementsByTagName, getElementsByTagNameNS, getFirstChild, getLastChild, hasChildNodes, insertBefore, normalize, removeChild, replaceChild
 
Methods inherited from class org.apache.xindice.xml.dom.NodeImpl
checkReadOnly, cloneNode, getAttributes, getDataBytes, getDataLen, getDataPos, getKey, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, getSource, getSymbolID, getUserData, hasAttributes, isDefined, isDirty, isLoaded, isSameNode, isSupported, load, lookupDefaultNamespaceURI, lookupNamespacePrefix, lookupNamespaceURI, normalizeNS, setDataBytes, setDataBytes, setDataLen, setDataPos, setDirty, setNodeName, setNodeValue, setParentNode, setPrefix, setSource, setUserData, unload
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.xindice.xml.dom.CompressedNode
getDataBytes, getDataLen, getDataPos, getSymbolID, isDirty, isLoaded, load, setDataBytes, setDataBytes, setDataLen, setDataPos, unload
 
Methods inherited from interface org.w3c.dom.Node
appendChild, cloneNode, getAttributes, getChildNodes, getFirstChild, getLastChild, getLocalName, getNamespaceURI, getNextSibling, getNodeValue, getOwnerDocument, getParentNode, getPrefix, getPreviousSibling, hasAttributes, hasChildNodes, insertBefore, isSupported, normalize, removeChild, replaceChild, setNodeValue, setPrefix
 
Methods inherited from interface org.w3c.dom.Document
getElementById, getElementsByTagName, getElementsByTagNameNS
 
Methods inherited from interface org.apache.xindice.xml.dom.DBNode
getSource, setSource
 

Constructor Detail

DocumentImpl

public DocumentImpl()

DocumentImpl

public DocumentImpl(byte[] data,
                    int pos,
                    int len)

DocumentImpl

public DocumentImpl(byte[] data)

DocumentImpl

public DocumentImpl(byte[] data,
                    SymbolTable symbols,
                    NodeSource source)

DocumentImpl

public DocumentImpl(org.w3c.dom.Document doc)
             throws XindiceException
Method Detail

isReadOnly

public boolean isReadOnly()

isCaching

public boolean isCaching()
Description copied from interface: DBDocument
getCaching returns whether or not this Document should be cached by some sort of caching mechanism.
Specified by:
isCaching in interface DBDocument
Following copied from interface: org.apache.xindice.xml.dom.DBDocument
Returns:
Whether or not the Document can be cached

setCaching

public void setCaching(boolean caching)
Description copied from interface: DBDocument
setCaching sets whether or not this Document should be cached by some sort of caching mechanism.
Specified by:
setCaching in interface DBDocument
Following copied from interface: org.apache.xindice.xml.dom.DBDocument
Parameters:
caching - Whether or not the Document can be cached

isAuthoring

public boolean isAuthoring()
Description copied from interface: DBDocument
isAuthoring returns whether or not this Document is in an authoring mode. Authoring mode is useful for Documents that dynamically generate themselves (like those that include Xindice autolinks) to tell the processor not to perform any dynamic modification.
Specified by:
isAuthoring in interface DBDocument
Following copied from interface: org.apache.xindice.xml.dom.DBDocument
Returns:
The authoring mode

setAuthoring

public void setAuthoring(boolean authoring)
Description copied from interface: DBDocument
setAuthoring sets whether or not this Document is in an authoring mode. Authoring mode is useful for Documents that dynamically generate themselves (like those that include Xindice autolinks) to tell the processor not to perform any dynamic modification.
Specified by:
setAuthoring in interface DBDocument
Following copied from interface: org.apache.xindice.xml.dom.DBDocument
Returns:
authoring The authoring mode

getSymbols

public SymbolTable getSymbols()
Description copied from interface: CompressedDocument
getSymbols returns the Symbol table for this Document. A new Document may not have a Symbol table as Symbol tables only come into play when a Document has been compressed or decompressed.
Specified by:
getSymbols in interface CompressedDocument
Following copied from interface: org.apache.xindice.xml.dom.CompressedDocument
Returns:
The Symbol table

setSymbols

public void setSymbols(SymbolTable symbols)
Description copied from interface: CompressedDocument
setSymbols sets the Symbol table for this Document. Setting the Symbol table for a Document that already has a Symbol table could be VERY BAD. Generally, an implementation should throw a DOMException if an attempt is made to reassign a Symbol table.
Specified by:
setSymbols in interface CompressedDocument
Following copied from interface: org.apache.xindice.xml.dom.CompressedDocument
Parameters:
symbols - The Symbol table
Throws:
org.w3c.dom.DOMException - if an exception occurs

expandSource

public void expandSource()
Description copied from interface: DBNode
expandSource expands the source into the Node as a namespace and a set of attributes. This method will only work on a Document or an Element, and should silently fail on all other Node types.
Specified by:
expandSource in interface DBNode
Overrides:
expandSource in class NodeImpl

getNodeAtPos

public org.w3c.dom.Node getNodeAtPos(int pos)
Description copied from interface: CompressedDocument
getNodeAtPos returns the Node that exists at the specified byte data position in the compressed stream. This method should only be used on an unmodified Document as the underlying compressed stream of a document will become invalid as the Document is modified.
Specified by:
getNodeAtPos in interface CompressedDocument
Following copied from interface: org.apache.xindice.xml.dom.CompressedDocument
Parameters:
pos - The compressed stream position
Returns:
The Node (or null if not found)

getNodeType

public short getNodeType()
Description copied from class: NodeImpl
A code representing the type of the underlying object, as defined above.
Specified by:
getNodeType in interface org.w3c.dom.Node
Overrides:
getNodeType in class NodeImpl

getNodeName

public java.lang.String getNodeName()
Description copied from class: NodeImpl
The name of this node, depending on its type; see the table above.
Specified by:
getNodeName in interface org.w3c.dom.Node
Overrides:
getNodeName in class NodeImpl

getDoctype

public org.w3c.dom.DocumentType getDoctype()
The Document Type Declaration (see DocumentType) associated with this document. For HTML documents as well as XML documents without a document type declaration this returns null. The DOM Level 1 does not support editing the Document Type Declaration, therefore docType cannot be altered in any way.
Specified by:
getDoctype in interface org.w3c.dom.Document

setDoctype

public void setDoctype(org.w3c.dom.DocumentType docType)

getImplementation

public org.w3c.dom.DOMImplementation getImplementation()
The DOMImplementation object that handles this document. A DOM application may use objects from multiple implementations.
Specified by:
getImplementation in interface org.w3c.dom.Document

createTextNode

public org.w3c.dom.Text createTextNode(java.lang.String data)
Creates a Text node given the specified string.
Specified by:
createTextNode in interface org.w3c.dom.Document
Parameters:
data - The data for the node.
Returns:
The new Text object.

getDocumentElement

public org.w3c.dom.Element getDocumentElement()
This is a convenience attribute that allows direct access to the child node that is the root element of the document. For HTML documents, this is the element with the tagName "HTML".
Specified by:
getDocumentElement in interface org.w3c.dom.Document

createCDATASection

public org.w3c.dom.CDATASection createCDATASection(java.lang.String data)
                                            throws org.w3c.dom.DOMException
Creates a CDATASection node whose value is the specified string.
Specified by:
createCDATASection in interface org.w3c.dom.Document
Parameters:
data - The data for the CDATASection contents.
Returns:
The new CDATASection object.
Throws:
org.w3c.dom.DOMException - NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

createElement

public org.w3c.dom.Element createElement(java.lang.String tagName)
                                  throws org.w3c.dom.DOMException
Creates an element of the type specified. Note that the instance returned implements the Element interface, so attributes can be specified directly on the returned object.
Specified by:
createElement in interface org.w3c.dom.Document
Parameters:
tagName - The name of the element type to instantiate. For XML, this is case-sensitive. For HTML, the tagName parameter may be provided in any case, but it must be mapped to the canonical uppercase form by the DOM implementation.
Returns:
A new Element object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createDocumentFragment

public org.w3c.dom.DocumentFragment createDocumentFragment()
Creates an empty DocumentFragment object.
Specified by:
createDocumentFragment in interface org.w3c.dom.Document
Returns:
A new DocumentFragment.

createAttribute

public org.w3c.dom.Attr createAttribute(java.lang.String name)
                                 throws org.w3c.dom.DOMException
Creates an Attr of the given name. Note that the Attr instance can then be set on an Element using the setAttribute method.
Specified by:
createAttribute in interface org.w3c.dom.Document
Parameters:
name - The name of the attribute.
Returns:
A new Attr object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.

createComment

public org.w3c.dom.Comment createComment(java.lang.String data)
Creates a Comment node given the specified string.
Specified by:
createComment in interface org.w3c.dom.Document
Parameters:
data - The data for the node.
Returns:
The new Comment object.

createProcessingInstruction

public org.w3c.dom.ProcessingInstruction createProcessingInstruction(java.lang.String target,
                                                                     java.lang.String data)
                                                              throws org.w3c.dom.DOMException
Creates a ProcessingInstruction node given the specified name and data strings.
Specified by:
createProcessingInstruction in interface org.w3c.dom.Document
Parameters:
target - The target part of the processing instruction.
data - The data for the node.
Returns:
The new ProcessingInstruction object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if an invalid character is specified.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

createEntityReference

public org.w3c.dom.EntityReference createEntityReference(java.lang.String name)
                                                  throws org.w3c.dom.DOMException
Creates an EntityReference object.
Specified by:
createEntityReference in interface org.w3c.dom.Document
Parameters:
name - The name of the entity to reference.
Returns:
The new EntityReference object.
Throws:
org.w3c.dom.DOMException - INVALID_CHARACTER_ERR: Raised if the specified name contains an invalid character.
NOT_SUPPORTED_ERR: Raised if this document is an HTML document.

importNode

public org.w3c.dom.Node importNode(org.w3c.dom.Node importedNode,
                                   boolean deep)
Specified by:
importNode in interface org.w3c.dom.Document

createElementNS

public org.w3c.dom.Element createElementNS(java.lang.String namespaceURI,
                                           java.lang.String qualifiedName)
Specified by:
createElementNS in interface org.w3c.dom.Document

createAttributeNS

public org.w3c.dom.Attr createAttributeNS(java.lang.String namespaceURI,
                                          java.lang.String qualifiedName)
Specified by:
createAttributeNS in interface org.w3c.dom.Document

createNodeIterator

public org.w3c.dom.traversal.NodeIterator createNodeIterator(org.w3c.dom.Node root,
                                                             int whatToShow,
                                                             org.w3c.dom.traversal.NodeFilter filter,
                                                             boolean entityReferenceExpansion)
                                                      throws org.w3c.dom.DOMException
Specified by:
createNodeIterator in interface org.w3c.dom.traversal.DocumentTraversal

createTreeWalker

public org.w3c.dom.traversal.TreeWalker createTreeWalker(org.w3c.dom.Node root,
                                                         int whatToShow,
                                                         org.w3c.dom.traversal.NodeFilter filter,
                                                         boolean entityReferenceExpansion)
                                                  throws org.w3c.dom.DOMException
Specified by:
createTreeWalker in interface org.w3c.dom.traversal.DocumentTraversal

adoptNode

public org.w3c.dom.Node adoptNode(org.w3c.dom.Node src)

getActualEncoding

public java.lang.String getActualEncoding()

setActualEncoding

public void setActualEncoding(java.lang.String actualEncoding)

getEncoding

public java.lang.String getEncoding()

setEncoding

public void setEncoding(java.lang.String encoding)

getVersion

public java.lang.String getVersion()

setVersion

public void setVersion(java.lang.String version)

getStandalone

public boolean getStandalone()

setStandalone

public void setStandalone(boolean standalone)

getStrictErrorChecking

public boolean getStrictErrorChecking()

setStrictErrorChecking

public void setStrictErrorChecking(boolean strictErrorChecking)

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation