|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.fikin.sql.SQLPipeElement net.sf.fikin.sql.core.SimpleXmlFile
public class SimpleXmlFile
Read an XML file and executes the sql statements inside.
It recognizes one tag only which by default is set to uri="http://fikin-ant-tasks.sf.net/sql/simple-input.xsd" and localName="stmt"
One can modify this via object's setter methods.
It treats the text inside the tags as an executable sql statement and does not recognize nested xml tags. In such case an SQXException exception is raisen.
This object accepts file, file name or input stream as input source.
File parsing is based on SAX.
created on Dec 17, 2006
Nested Class Summary | |
---|---|
class |
SimpleXmlFile.SimpleSAXParser
recognizes only getTag() tag and extract
its characters if any
nested tags would cause SAXException
created on Dec 17, 2006 |
Field Summary | |
---|---|
static java.lang.String |
DEFAULT_TAG
default tag local name, this parser is configured with |
static java.lang.String |
DEFAULT_URI
default URI this XML parser is configured with |
Constructor Summary | |
---|---|
SimpleXmlFile()
default constructs |
Method Summary | |
---|---|
protected SimpleXmlFile.SimpleSAXParser |
createParser()
instantiate new SAX parser object template method |
protected org.xml.sax.XMLReader |
createReader()
create XML reader |
void |
execute(java.lang.String cmd)
start the XML processing and execute sql statements by delegating them to the next in the pipe |
java.lang.String |
getFileName()
get input's file name if given via File-complient set input methods |
org.xml.sax.InputSource |
getInputSource()
get the assigned input source |
SimpleXmlFile.SimpleSAXParser |
getSAXParser()
get SimpleSAXParser |
java.lang.String |
getTag()
what is the tag's name, recognized by the XML parser |
java.lang.String |
getURI()
what is the tag's URI, recognized by the XML parser |
org.xml.sax.XMLReader |
getXMLReader()
get XMLReader |
void |
setInputSource(java.io.File input)
set the input to parse |
void |
setInputSource(org.xml.sax.InputSource input)
set the input to parse |
void |
setInputSource(java.io.InputStream input)
set the input to parse |
void |
setInputSource(java.io.Reader input)
set the input to parse |
void |
setInputSource(java.lang.String systemId)
set the input to parse |
void |
setInputSourceFileName(java.lang.String file)
set the input to parse |
void |
setSAXParser(SimpleXmlFile.SimpleSAXParser parser)
setter for SimpleSAXParser used to parse the input source |
void |
setTag(java.lang.String tag)
assign custom defined tag's name the XML is to use |
void |
setURI(java.lang.String uri)
assign custom defined tag's URI the XML is to use |
void |
setXMLReader(org.xml.sax.XMLReader reader)
setter for XMLReader used to parse the input source |
Methods inherited from class net.sf.fikin.sql.SQLPipeElement |
---|
getBaseClassName, getId, getNext, getPipe, setNext, setPipe |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String DEFAULT_URI
public static final java.lang.String DEFAULT_TAG
Constructor Detail |
---|
public SimpleXmlFile() throws org.xml.sax.SAXException
org.xml.sax.SAXException
Method Detail |
---|
public java.lang.String getURI()
DEFAULT_URI
public void setURI(java.lang.String uri)
uri
- public java.lang.String getTag()
DEFAULT_TAG
public void setTag(java.lang.String tag)
tag
- public java.lang.String getFileName()
public void setSAXParser(SimpleXmlFile.SimpleSAXParser parser)
parser
- public SimpleXmlFile.SimpleSAXParser getSAXParser()
public void setXMLReader(org.xml.sax.XMLReader reader)
reader
- public org.xml.sax.XMLReader getXMLReader()
public org.xml.sax.InputSource getInputSource()
public void setInputSource(org.xml.sax.InputSource input)
input
- sourcepublic void setInputSource(java.io.InputStream input)
input
- streampublic void setInputSource(java.io.Reader input)
input
- readerpublic void setInputSource(java.io.File input) throws java.io.FileNotFoundException
input
- file
java.io.FileNotFoundException
public void setInputSource(java.lang.String systemId)
systemId
- public void setInputSourceFileName(java.lang.String file) throws java.io.FileNotFoundException
file
- to use as input
java.io.FileNotFoundException
public void execute(java.lang.String cmd) throws java.sql.SQLException
execute
in class SQLPipeElement
cmd
- does not matter at all
java.sql.SQLException
- in case of errorprotected SimpleXmlFile.SimpleSAXParser createParser()
protected org.xml.sax.XMLReader createReader() throws org.xml.sax.SAXException
org.xml.sax.SAXException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |