org.exist
Class Indexer

java.lang.Object
  extended byjava.util.Observable
      extended byorg.exist.Indexer
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler

public class Indexer
extends java.util.Observable
implements org.xml.sax.ContentHandler, org.xml.sax.ext.LexicalHandler, org.xml.sax.ErrorHandler

Parses a given input document via SAX, stores it to the database and handles index-creation.

Author:
wolf

Field Summary
static java.lang.String PROPERTY_SUPPRESS_WHITESPACE
           
 
Constructor Summary
Indexer(DBBroker broker, Txn transaction)
          Create a new parser using the given database broker and user to store the document.
Indexer(DBBroker broker, Txn transaction, boolean priv)
          Create a new parser using the given database broker and user to store the document.
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void comment(char[] ch, int start, int length)
           
 void endCDATA()
           
 void endDocument()
           
 void endDTD()
           
 void endElement(java.lang.String namespace, java.lang.String name, java.lang.String qname)
           
 void endEntity(java.lang.String name)
           
 void endPrefixMapping(java.lang.String prefix)
           
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
 DocumentImpl getDocument()
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 void setDocument(DocumentImpl doc)
          Prepare the indexer for parsing a new document.
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void setDocumentObject(DocumentImpl doc)
          Set the document object to be used by this Indexer.
 void setValidating(boolean validate)
           
 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 namespace, java.lang.String name, java.lang.String qname, org.xml.sax.Attributes attributes)
           
 void startEntity(java.lang.String name)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_SUPPRESS_WHITESPACE

public static java.lang.String PROPERTY_SUPPRESS_WHITESPACE
Constructor Detail

Indexer

public Indexer(DBBroker broker,
               Txn transaction)
        throws EXistException
Create a new parser using the given database broker and user to store the document.

Parameters:
broker -
Throws:
EXistException

Indexer

public Indexer(DBBroker broker,
               Txn transaction,
               boolean priv)
        throws EXistException
Create a new parser using the given database broker and user to store the document.

Parameters:
broker - The database broker to use.
transaction - The transaction to use for indexing
priv - used by the security manager to indicate that it needs privileged access to the db.
Throws:
EXistException
Method Detail

setValidating

public void setValidating(boolean validate)

setDocument

public void setDocument(DocumentImpl doc)
Prepare the indexer for parsing a new document. This will reset the internal state of the Indexer object.

Parameters:
doc -

setDocumentObject

public void setDocumentObject(DocumentImpl doc)
Set the document object to be used by this Indexer. This method doesn't reset the internal state.

Parameters:
doc -

getDocument

public DocumentImpl getDocument()

characters

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

comment

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

endCDATA

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

endDTD

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

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler

endElement

public void endElement(java.lang.String namespace,
                       java.lang.String name,
                       java.lang.String qname)
Specified by:
endElement in interface org.xml.sax.ContentHandler

endEntity

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

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

error

public void error(org.xml.sax.SAXParseException e)
           throws org.xml.sax.SAXException
Specified by:
error in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
                throws org.xml.sax.SAXException
Specified by:
fatalError in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException

ignorableWhitespace

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

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

setDocumentLocator

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

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

startCDATA

public void startCDATA()
Specified by:
startCDATA 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

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler

startElement

public void startElement(java.lang.String namespace,
                         java.lang.String name,
                         java.lang.String qname,
                         org.xml.sax.Attributes attributes)
                  throws org.xml.sax.SAXException
Specified by:
startElement in interface org.xml.sax.ContentHandler
Throws:
org.xml.sax.SAXException

startEntity

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

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler

warning

public void warning(org.xml.sax.SAXParseException e)
             throws org.xml.sax.SAXException
Specified by:
warning in interface org.xml.sax.ErrorHandler
Throws:
org.xml.sax.SAXException


Copyright (C) Wolfgang Meier. All rights reserved.