public class XMLConfigParser
extends DefaultHandler
<?xml version="1.0" encoding="utf-8"?>
<textIndexer-config>
<index name="IndexName">
<db path="LuceneIndexPath"/>
<src path="XMLSourcePath"/>
<chunk size="ChunkSize"
overlap="ChunkOverlap"/>
<skip files= "*.xxx*, *.yyy, ... "/>
<inputfilter path="XSLPreFilterFile"/>
</index>
</textIndexer-config>
The arguments should appear at most once for each index specified. If
multiple instances of the arguments are specified for an index, the
last one is used.
<?xml version="1.0" encoding="utf-8"?>
<textIndexer-config>
<index name="AllText">
<db path="./IndexDBs"/>
<src path="./SourceText"/>
<chunk size="100" overlap="50"/>
<skip files="*.mets*, *AuthMech*"/>
<inputfilter path="./BasicFilter.xsl"/>
</index>
</textIndexer-config>
DefaultHandler
class so that
its startElement()
and endElement()
methods can be called internally from the Java SAXParser
class. configure()
method.Modifier and Type | Field and Description |
---|---|
private IndexerConfig |
configInfo |
private boolean |
indexNameFound |
private boolean |
inNamedIndexBlock |
private boolean |
isConfigFile |
Constructor and Description |
---|
XMLConfigParser() |
Modifier and Type | Method and Description |
---|---|
int |
configure(IndexerConfig cfgInfo)
This method parses a config file and stores the resulting parameters in
a config info structure.
|
void |
endElement(String uri,
String localName,
String qName)
Methed called when the end tag is encountered in the config file.
|
void |
startElement(String uri,
String localName,
String qName,
Attributes atts)
Methed called when the start tag is encountered in the config file.
|
private boolean isConfigFile
private boolean indexNameFound
private boolean inNamedIndexBlock
private IndexerConfig configInfo
public int configure(IndexerConfig cfgInfo) throws Exception
cfgInfo
- Upon entry, a config structure with the path/name of the
config file to read in the
cfgFilePath
field. Exception
- Any internal exceptions generated while parsing the
configuration file. XMLConfigParser
class. public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException
DefaultHandler
class so that the parser can call this method each time a start tag is
encountered in the XML config file.startElement
in interface ContentHandler
startElement
in class DefaultHandler
uri
- The current namespace URI in use.localName
- The local name (i.e., without prefix) of the current
element, or the empty string if namespace processing is
disabled.qName
- The qualified name (i.e., with prefix) for the current
element, or the empty string if qualified names are
disabled.atts
- The specified or defaulted arguments for the current
element. These consist of any xxx = "yyy"
style arguments for the element within the < and >.
SAXException
- Any internal exceptions generated due to
syntax problems in the element. XMLConfigParser
class. public void endElement(String uri, String localName, String qName) throws SAXException
DefaultHandler
class so that the parser can call this method each time an end tag
is encountered in the XML config file.endElement
in interface ContentHandler
endElement
in class DefaultHandler
uri
- The current namespace URI in use.localName
- The local name (i.e., without prefix) of the current
element, or the empty string if namespace processing is
disabled.qName
- The qualified name (i.e., with prefix) for the current
element, or the empty string if qualified names are
disabled.SAXException
- If any internal exceptions generated due to
syntax problems in the element. XMLConfigParser
class.