org.apache.lucenesandbox.xmlindexingdemo
Class XMLDocumentHandlerSAX
java.lang.Object
org.xml.sax.HandlerBase
org.apache.lucenesandbox.xmlindexingdemo.XMLDocumentHandlerSAX
- All Implemented Interfaces:
- org.xml.sax.DocumentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler
public class XMLDocumentHandlerSAX
- extends org.xml.sax.HandlerBase
Field Summary |
private org.apache.lucene.document.Document |
doc
|
private java.util.ArrayList |
docs
|
private java.lang.String |
docTag
Tag that indicates document |
private java.lang.StringBuffer |
elementBuffer
A buffer for each XML element |
Methods inherited from class org.xml.sax.HandlerBase |
endDocument, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, unparsedEntityDecl, warning |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
elementBuffer
private java.lang.StringBuffer elementBuffer
- A buffer for each XML element
doc
private org.apache.lucene.document.Document doc
docs
private java.util.ArrayList docs
docTag
private java.lang.String docTag
- Tag that indicates document
XMLDocumentHandlerSAX
public XMLDocumentHandlerSAX(java.io.File xmlFile,
java.lang.String docTag)
throws javax.xml.parsers.ParserConfigurationException,
org.xml.sax.SAXException,
java.io.IOException
- Parameters:
xmlFile
- docTag
- - Tag that indicates document
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
startDocument
public void startDocument()
- Specified by:
startDocument
in interface org.xml.sax.DocumentHandler
- Overrides:
startDocument
in class org.xml.sax.HandlerBase
startElement
public void startElement(java.lang.String localName,
org.xml.sax.AttributeList atts)
throws org.xml.sax.SAXException
- Specified by:
startElement
in interface org.xml.sax.DocumentHandler
- Overrides:
startElement
in class org.xml.sax.HandlerBase
- Throws:
org.xml.sax.SAXException
characters
public void characters(char[] text,
int start,
int length)
- Specified by:
characters
in interface org.xml.sax.DocumentHandler
- Overrides:
characters
in class org.xml.sax.HandlerBase
endElement
public void endElement(java.lang.String localName)
throws org.xml.sax.SAXException
- Specified by:
endElement
in interface org.xml.sax.DocumentHandler
- Overrides:
endElement
in class org.xml.sax.HandlerBase
- Throws:
org.xml.sax.SAXException
getDocuments
public java.util.ArrayList getDocuments()