|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ricebridge.xmlman.in.XmlInputHandler
Handles XML loading and parsing operations.
This is a single use object, a new instance must be created for each operation.
Used internally by XmlManager.
| Constructor Summary | |
XmlInputHandler()
Empty constructor. |
|
| Method Summary | |
XmlInputHandler |
copy(XmlSpec pXmlSpec)
Create a copy with new XmlSpec. |
RecordListener |
getAutoRecordListener()
Retrieve the automatic RecordListener object for the current load operation. |
BadRecordListener |
getBadRecordListener()
Get the BadRecordListener object currently in use. |
String[] |
getFieldNames()
Get the field names of the primary RecordSpec - may be null. |
RecordListener |
getRecordListener()
Get the current RecordListener. |
SAXParserFactory |
getSAXParserFactory()
Get the current SAXParserFactory used for creating XML parsers. |
MutableStats |
getStats()
Get the current Stats object used when loading XML record data. |
XmlSpec |
getXmlSpec()
Get the current XmlSpec object to use when loading XML record data. |
boolean |
isFinished()
When true, the loading process has finished. |
void |
loadSaxFile(File pXmlFile)
Load XML data from a file, using a SAX parser. |
void |
loadSaxFromString(String pXmlString)
Load XML data from a String, using a SAX parser. |
void |
loadSaxInputSource(InputSource pXmlInputSource)
Load XML data from an InputSource, using a SAX parser. |
void |
loadSaxInputStream(InputStream pXmlInputStream)
Load XML data from an InputStream, using a SAX parser. |
void |
loadSaxURI(String pURI)
Load XML data from a Uniform Resource Identifier (URI), using a SAX parser. |
static String |
makeEncoding(XmlSpec pXmlSpec)
Resolve the current encoding using the current XmlSpec. |
static ParseResult |
parse(String pPathString,
XmlSpec pXmlSpec,
boolean pMustBeLocationPath,
boolean pSplitOnDescend)
Parse an XPath string into a set of TargetPaths. |
void |
prepare(RecordSpec pRecordSpec)
Prepare internal data structures using the specified RecordSpec. |
SaxHandler |
prepareSaxHandler()
Create a SaxHandler initialised with the current list of TargetPaths. |
void |
run()
Start loading operation in separate Thread. |
void |
setAutoRecordListener(RecordListener pRecordListener)
Store the automatic RecordListener object for the current load operation. |
void |
setBadRecordListener(BadRecordListener pBadRecordListener)
Set the BadRecordListener object to receive BadRecord description objects
as bad data records are encountered. |
void |
setRecordListener(RecordListener pRecordListener)
Set the RecordListener for the current parse operation. |
void |
setSAXParserFactory(SAXParserFactory pSAXParserFactory)
Set the SAXParserFactory object that creates the
SAXParser object for parsing XML. |
void |
setStats(MutableStats pStats)
Set the Stats object to use when loading XML record data. |
void |
setXmlSpec(XmlSpec pXmlSpec)
Set the XmlSpec object to use when loading XML record data. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public XmlInputHandler()
| Method Detail |
public XmlInputHandler copy(XmlSpec pXmlSpec)
XmlSpec.
public void run()
run in interface RunnableXmlSpec.setBackground(boolean)public boolean isFinished()
true, the loading process has finished.
When false, the loading process is still in progress.
Use this method when the loading process is running in the background as a separate thread.
See XmlSpec.setBackground(boolean) for details.
XmlSpec.setBackground(boolean)public void setXmlSpec(XmlSpec pXmlSpec)
XmlSpec object to use when loading XML record data.
The XmlSpec class lets you set the options to use when
loading XML. For full details, see the XmlSpec documentation.
pXmlSpec - the XmlSpec object to useXmlSpecpublic XmlSpec getXmlSpec()
XmlSpec object to use when loading XML record data.
If no XmlSpec has been specified, a default one will be
created and stored.
setXmlSpec(com.ricebridge.xmlman.XmlSpec)public void setStats(MutableStats pStats)
Stats object to use when loading XML record data.
Statistics (such as number of records) are saved to this object.
pStats - Stats object to useStatspublic MutableStats getStats()
Stats object used when loading XML record data.
If no Stats object has been specified, a default one will be
created and stored.
setStats(com.ricebridge.xmlman.in.MutableStats)public void setAutoRecordListener(RecordListener pRecordListener)
RecordListener object for the current load operation.
This RecordListener is automatically used by the load operation.
pRecordListener - automatic RecordListenerpublic RecordListener getAutoRecordListener()
RecordListener object for the current load operation.
setAutoRecordListener(com.ricebridge.xmlman.RecordListener)public void setBadRecordListener(BadRecordListener pBadRecordListener)
BadRecordListener object to receive BadRecord description objects
as bad data records are encountered.
If the ignore bad records option is true
then each BadRecord is reported to the BadRecordListener. If it is
false, then only the first BadRecord is reported, before processing halts.
pBadRecordListener - BadRecordListener objectpublic BadRecordListener getBadRecordListener()
BadRecordListener object currently in use.
If a BadRecordListener object has not been specified
then a default one will be created and stored.
public void setSAXParserFactory(SAXParserFactory pSAXParserFactory)
SAXParserFactory object that creates the
SAXParser object for parsing XML.
This method can be used to customize XML parsing.
pSAXParserFactory - a SAXParserFactory implementationpublic SAXParserFactory getSAXParserFactory()
SAXParserFactory used for creating XML parsers.
public void prepare(RecordSpec pRecordSpec)
RecordSpec.
This method is called once for each RecordSpec before parsing
begins to prepare the XmlInputHandler object for the loading operation.
pRecordSpec - RecordSpec object to addRecordSpecpublic String[] getFieldNames()
RecordSpec - may be null.
public void setRecordListener(RecordListener pRecordListener)
RecordListener for the current parse operation.
public RecordListener getRecordListener()
RecordListener.
public void loadSaxFile(File pXmlFile)
pXmlFile - XML file to loadpublic void loadSaxInputStream(InputStream pXmlInputStream)
InputStream, using a SAX parser.
pXmlInputStream - InputStream providing XML datapublic void loadSaxInputSource(InputSource pXmlInputSource)
InputSource, using a SAX parser.
pXmlInputSource - InputSource providing XML datapublic void loadSaxURI(String pURI)
pURI - URI indicating location of XML datapublic void loadSaxFromString(String pXmlString)
pXmlString - String containing XMLpublic static String makeEncoding(XmlSpec pXmlSpec)
XmlSpec.
Defaults to UTF-8 if no encoding is specified.
public SaxHandler prepareSaxHandler()
TargetPaths.
public static ParseResult parse(String pPathString,
XmlSpec pXmlSpec,
boolean pMustBeLocationPath,
boolean pSplitOnDescend)
TargetPaths.
Normally, pSplitOnDescend should be true when inputing XML
and false when outputting XML.
pPathString - String containing XPath expressionpXmlSpec - XmlSpec object defining namespaces, etc.pMustBeLocationPath - XPath must be a location path, not a literal or functionpSplitOnDescend - split TargetPath at descend points
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||