Qizx/Open v0.4

net.xfra.qizxopen.dm
Class IDocument

java.lang.Object
  |
  +--org.xml.sax.helpers.DefaultHandler
        |
        +--net.xfra.qizxopen.dm.FONIWriter
              |
              +--net.xfra.qizxopen.dm.IDocument
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, FONIDocument, org.xml.sax.ext.LexicalHandler

public class IDocument
extends FONIWriter
implements FONIDocument

A fast and memory efficient FONIDocument implementation for parsed documents. Once built, it is readonly and thread safe.


Nested Class Summary
 class IDocument.AttrIterator
           
 
Nested classes inherited from class net.xfra.qizxopen.dm.FONIDocument
 
Constructor Summary
IDocument()
           
 
Method Summary
 void atom(java.lang.Object value)
          Creates an atom with any object value.
 FONIDocument.NodeIterator attrIterator(int id)
          Returns an Attribute iterator for a node.
 void characters(char[] ch, int start, int length)
           
 void characters(java.lang.String chars)
          A variant of SAX.characters(char[], ...)
 FONIDocument.NodeIterator childrenIterator(int id)
           
 void close()
           
 void comment(char[] ch, int start, int length)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endEntity(java.lang.String name)
           
 void endPrefixMapping(java.lang.String prefix)
           
 int estimateMemorySize()
          Cache management.
 int getAttrCount(int nodeId)
          Returns the number of attributes of an element (not guaranteed to be efficient).
 int getAttribute(int nodeId, int nameId)
          Gets an attribute node by name.
 java.lang.String getBaseURI()
          Returns the URI of the document.
 char[] getCharValue(int nodeId, int reserve)
          Specially meant for indexing: gets the string value of a text node.
 int getCurrentNode()
           
 int getDefinedNSCount(int nodeId)
          Returns the number of NS defined on this node.
 int getDocId()
           
 QName getElementName(int nameId)
          Gets the QName of an element node by the internal id.
 int getElementNameCount()
          Gets the total number of element names.
 int getFirstChild(int nodeId)
           
 long getIntegerValue(int nodeId)
          Gets an integer value from an atome of type ATOM_INT.
 int getKind(int nodeId)
          Returns one of the kinds DOCUMENT, ELEMENT, TEXT, PROCESSING_INSTRUCTION, COMMENT, ATTRIBUTE, NAMESPACE, ATOM_XX.
 QName getName(int nodeId)
          Gets the name of a Node.
 int getNameId(int offset)
          Gets the name-id of a real Node.
 int getNextSibling(int nodeId)
           
 int getNodeAfter(int nodeId)
          Gets the node that is next in document order but not contained.
 int getNodeNext(int nodeId)
          Gets the node that is next in document order.
 int getNodeSpan(int nodeId)
           
 QName getOtherName(int nameId)
          Gets the QName of a non-element node by the internal id.
 int getOtherNameCount()
          Gets the total number of non-element node names.
 int getParent(int nodeId)
           
 int getRootNode()
          Returns the handle of the document node.
 java.lang.String getStringValue(int nodeId)
          Gets the string value for any node but Attributes and Namespaces.
 java.lang.Object getValue(int nodeId)
          Gets an atomic value from a leaf node.
 int internElementName(QName name)
          Gets the internal id of an element name.
 int internOtherName(QName name)
          Gets the internal id of a non-element node name.
 FONIDocument.NodeIterator namespaceIterator(int nodeId, boolean inScope)
          Returns the namespace nodes of a node.
 char[] pnGetCharValue(int nodeId, int reserve)
          Specially meant for indexing: gets the string value of a "pseudo-node" (attribute or NS).
 QName pnGetName(int nodeId)
          Gets the name of a pseudo Node Attribute / Namespace.
 int pnGetNameId(int nodeId)
          Gets the name-id of a pseudo-node Attribute / Namespace.
 java.lang.String pnGetStringValue(int nodeId)
          Gets the string value for pseudo-nodes Attributes and Namespaces.
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 void setDocId(int value)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void skippedEntity(java.lang.String name)
           
 void startCDATA()
           
 void startDocument()
           
 void startDTD(java.lang.String name, java.lang.String publicId, java.lang.String systemId)
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes attrs)
           
 void startEntity(java.lang.String name)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 
Methods inherited from class net.xfra.qizxopen.dm.FONIWriter
getDocumentId, setDocumentId, setProgressHandler
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, ignorableWhitespace, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IDocument

public IDocument()
Method Detail

getBaseURI

public java.lang.String getBaseURI()
Description copied from interface: FONIDocument
Returns the URI of the document.

Specified by:
getBaseURI in interface FONIDocument

getRootNode

public int getRootNode()
Description copied from interface: FONIDocument
Returns the handle of the document node.

Specified by:
getRootNode in interface FONIDocument

setDocId

public void setDocId(int value)
Specified by:
setDocId in interface FONIDocument

getDocId

public int getDocId()
Specified by:
getDocId in interface FONIDocument

getName

public QName getName(int nodeId)
Description copied from interface: FONIDocument
Gets the name of a Node.

Specified by:
getName in interface FONIDocument

getNameId

public int getNameId(int offset)
Description copied from interface: FONIDocument
Gets the name-id of a real Node. All names are represented by an index in a name table.

Specified by:
getNameId in interface FONIDocument

pnGetName

public QName pnGetName(int nodeId)
Description copied from interface: FONIDocument
Gets the name of a pseudo Node Attribute / Namespace.

Specified by:
pnGetName in interface FONIDocument

pnGetNameId

public int pnGetNameId(int nodeId)
Description copied from interface: FONIDocument
Gets the name-id of a pseudo-node Attribute / Namespace.

Specified by:
pnGetNameId in interface FONIDocument

getParent

public int getParent(int nodeId)
Specified by:
getParent in interface FONIDocument

getNextSibling

public int getNextSibling(int nodeId)
Specified by:
getNextSibling in interface FONIDocument

getNodeNext

public int getNodeNext(int nodeId)
Description copied from interface: FONIDocument
Gets the node that is next in document order. (first child if non-atomic, otherwise returns getNodeAfter()).

Specified by:
getNodeNext in interface FONIDocument

getNodeAfter

public int getNodeAfter(int nodeId)
Description copied from interface: FONIDocument
Gets the node that is next in document order but not contained. It is the following sibling if any, else the parent's following sibling, recursively.

Specified by:
getNodeAfter in interface FONIDocument

getNodeSpan

public int getNodeSpan(int nodeId)
Specified by:
getNodeSpan in interface FONIDocument

getFirstChild

public int getFirstChild(int nodeId)
Specified by:
getFirstChild in interface FONIDocument

childrenIterator

public FONIDocument.NodeIterator childrenIterator(int id)
Specified by:
childrenIterator in interface FONIDocument

getAttrCount

public int getAttrCount(int nodeId)
Description copied from interface: FONIDocument
Returns the number of attributes of an element (not guaranteed to be efficient).

Specified by:
getAttrCount in interface FONIDocument

attrIterator

public FONIDocument.NodeIterator attrIterator(int id)
Description copied from interface: FONIDocument
Returns an Attribute iterator for a node.

Specified by:
attrIterator in interface FONIDocument

getAttribute

public int getAttribute(int nodeId,
                        int nameId)
Description copied from interface: FONIDocument
Gets an attribute node by name.

Specified by:
getAttribute in interface FONIDocument

getStringValue

public java.lang.String getStringValue(int nodeId)
Description copied from interface: FONIDocument
Gets the string value for any node but Attributes and Namespaces.

Specified by:
getStringValue in interface FONIDocument

pnGetStringValue

public java.lang.String pnGetStringValue(int nodeId)
Gets the string value for pseudo-nodes Attributes and Namespaces.

Specified by:
pnGetStringValue in interface FONIDocument

getCharValue

public char[] getCharValue(int nodeId,
                           int reserve)
Description copied from interface: FONIDocument
Specially meant for indexing: gets the string value of a text node. Returns the value into a char array, reserving chars (at head if reserve > 0).

Specified by:
getCharValue in interface FONIDocument

pnGetCharValue

public char[] pnGetCharValue(int nodeId,
                             int reserve)
Description copied from interface: FONIDocument
Specially meant for indexing: gets the string value of a "pseudo-node" (attribute or NS). Returns the value into a char array, possibly reserving leading chars.

Specified by:
pnGetCharValue in interface FONIDocument

getValue

public java.lang.Object getValue(int nodeId)
Description copied from interface: FONIDocument
Gets an atomic value from a leaf node.

Specified by:
getValue in interface FONIDocument

getIntegerValue

public long getIntegerValue(int nodeId)
Description copied from interface: FONIDocument
Gets an integer value from an atome of type ATOM_INT.

Specified by:
getIntegerValue in interface FONIDocument

getDefinedNSCount

public int getDefinedNSCount(int nodeId)
Description copied from interface: FONIDocument
Returns the number of NS defined on this node.

Specified by:
getDefinedNSCount in interface FONIDocument

namespaceIterator

public FONIDocument.NodeIterator namespaceIterator(int nodeId,
                                                   boolean inScope)
Description copied from interface: FONIDocument
Returns the namespace nodes of a node.

Specified by:
namespaceIterator in interface FONIDocument

getElementNameCount

public int getElementNameCount()
Description copied from interface: FONIDocument
Gets the total number of element names.

Specified by:
getElementNameCount in interface FONIDocument

getElementName

public QName getElementName(int nameId)
Description copied from interface: FONIDocument
Gets the QName of an element node by the internal id.

Specified by:
getElementName in interface FONIDocument

internElementName

public int internElementName(QName name)
Description copied from interface: FONIDocument
Gets the internal id of an element name.

Specified by:
internElementName in interface FONIDocument

getOtherNameCount

public int getOtherNameCount()
Description copied from interface: FONIDocument
Gets the total number of non-element node names.

Specified by:
getOtherNameCount in interface FONIDocument

getOtherName

public QName getOtherName(int nameId)
Description copied from interface: FONIDocument
Gets the QName of a non-element node by the internal id.

Specified by:
getOtherName in interface FONIDocument

internOtherName

public int internOtherName(QName name)
Description copied from interface: FONIDocument
Gets the internal id of a non-element node name.

Specified by:
internOtherName in interface FONIDocument

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler
Overrides:
setDocumentLocator in class org.xml.sax.helpers.DefaultHandler

close

public void close()
           throws java.io.IOException,
                  org.xml.sax.SAXException
Specified by:
close in class FONIWriter
java.io.IOException
org.xml.sax.SAXException

startDocument

public void startDocument()
                   throws org.xml.sax.SAXException
Specified by:
startDocument in interface org.xml.sax.ContentHandler
Overrides:
startDocument in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

endDocument

public void endDocument()
                 throws org.xml.sax.SAXException
Specified by:
endDocument in interface org.xml.sax.ContentHandler
Overrides:
endDocument in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes attrs)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
                throws org.xml.sax.SAXException
Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler
Overrides:
characters in class org.xml.sax.helpers.DefaultHandler

characters

public void characters(java.lang.String chars)
Description copied from class: FONIWriter
A variant of SAX.characters(char[], ...)

Specified by:
characters in class FONIWriter

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
                           throws org.xml.sax.SAXException
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler
Overrides:
processingInstruction in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

skippedEntity

public void skippedEntity(java.lang.String name)
                   throws org.xml.sax.SAXException
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler
Overrides:
skippedEntity in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
                        throws org.xml.sax.SAXException
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
startPrefixMapping in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
                      throws org.xml.sax.SAXException
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler
Overrides:
endPrefixMapping in class org.xml.sax.helpers.DefaultHandler
org.xml.sax.SAXException

comment

public void comment(char[] ch,
                    int start,
                    int length)
Specified by:
comment in interface org.xml.sax.ext.LexicalHandler

startCDATA

public void startCDATA()
Specified by:
startCDATA in interface org.xml.sax.ext.LexicalHandler

endCDATA

public void endCDATA()
Specified by:
endCDATA in interface org.xml.sax.ext.LexicalHandler

startDTD

public void startDTD(java.lang.String name,
                     java.lang.String publicId,
                     java.lang.String systemId)
Specified by:
startDTD in interface org.xml.sax.ext.LexicalHandler

endDTD

public void endDTD()
Specified by:
endDTD in interface org.xml.sax.ext.LexicalHandler

startEntity

public void startEntity(java.lang.String name)
Specified by:
startEntity in interface org.xml.sax.ext.LexicalHandler

endEntity

public void endEntity(java.lang.String name)
Specified by:
endEntity in interface org.xml.sax.ext.LexicalHandler

atom

public void atom(java.lang.Object value)
          throws org.xml.sax.SAXException
Description copied from class: FONIWriter
Creates an atom with any object value. This value must be serializable.

Specified by:
atom in class FONIWriter
org.xml.sax.SAXException

getCurrentNode

public int getCurrentNode()

estimateMemorySize

public int estimateMemorySize()
Description copied from interface: FONIDocument
Cache management.

Specified by:
estimateMemorySize in interface FONIDocument

getKind

public int getKind(int nodeId)
Description copied from interface: FONIDocument
Returns one of the kinds DOCUMENT, ELEMENT, TEXT, PROCESSING_INSTRUCTION, COMMENT, ATTRIBUTE, NAMESPACE, ATOM_XX.

Specified by:
getKind in interface FONIDocument

 Copyright Xavier FRANC 2003-2004