public class XMLResultSetFactory extends Object implements ResultSetFactory
ResultSet based on
a an XML Document of the proper format. You can specify
the dialect, for proper parsing of the document. Furthermore you can
specify the dialect of the ResultSet, which determines
the expected format of the XML Document and whether or not
the column entries should be trimmed (default is true).
The file can be specified directly or by its name. The class
tries to find the file in the absolut or relative path and
(if not found) by calling getResource. Note that the
file must exist in the local file system and cannot be loaded from
inside a jar archive.| Modifier and Type | Field and Description |
|---|---|
static int |
SQUIRREL_DIALECT |
static int |
SYBASE_DIALECT |
| Constructor and Description |
|---|
XMLResultSetFactory(File file) |
XMLResultSetFactory(String fileName) |
| Modifier and Type | Method and Description |
|---|---|
MockResultSet |
create(String id)
Makes and returns a MockResultSet created from
an existing and valid XML
Document. |
MockResultSet |
createSquirrelResultSet(String id)
Return a MockResultSet with proper column names and
rows based on the XML
Document. |
MockResultSet |
createSybaseResultSet(String id)
Return a MockResultSet with proper column names and
rows based on the XML
Document. |
int |
getDialect()
Get the dialect of the XML Document
|
boolean |
getTrim()
Get whether or not trim is true or false.
|
File |
getXMLFile()
Get the
File being used to read in the
ResultSet. |
void |
setDialect(int dialect)
Set the dialect of the XML
Document. |
void |
setTrim(boolean trim)
Set if the column entries should be trimmed.
|
public static final int SYBASE_DIALECT
public static final int SQUIRREL_DIALECT
public XMLResultSetFactory(String fileName)
public XMLResultSetFactory(File file)
public MockResultSet create(String id)
Document.create in interface ResultSetFactorypublic File getXMLFile()
File being used to read in the
ResultSet. Returns null if
the file does not exist.public void setTrim(boolean trim)
true.trim - public boolean getTrim()
public void setDialect(int dialect)
Document. Can be
different for different database systems.
Will determine the expected XML format for
the ResultSet. SYBASE_DIALECT
is the only accepted dialect for now.dialect - int specifying which createXXXResultSet
method to call.public int getDialect()
Document
- Returns:
- dialect
-
createSybaseResultSet
public MockResultSet createSybaseResultSet(String id)
Return a MockResultSet with proper column names and
rows based on the XML Document.
- Returns:
- MockResultSet Results read from XML
Document.
-
createSquirrelResultSet
public MockResultSet createSquirrelResultSet(String id)
Return a MockResultSet with proper column names and
rows based on the XML Document.
- Returns:
- MockResultSet Results read from XML
Document.
Copyright © 2003-2014. All Rights Reserved.