| java.lang.Object org.webdocwf.util.xml.XmlWriter
XmlWriter | public class XmlWriter (Code) | | Load existing XML file , creating DOM from file or creating
new DOM.Class has methods for insert,update,delete data from XML file and save new DOM in XML file.
author: Zoran Milakovic |
Constructor Summary | |
public | XmlWriter(String fileName, boolean isAutoCommit) Constructor used when autoCommit is set to false or true. |
Method Summary | |
public static void | commit(String fileName) Method is used for saving DOM in xml file from connection object,when XmlConnection.commit() method
is called. | protected void | createDatabase() Method is called when create new database file. | protected void | createTable(String sqlStatement, String tableName) Adds sql statement CREATE TABLE in XML file. | protected void | delete(String tableName, String[] whereColumnNames, String[] whereColumnValues) Delete row(s) from XML file. | protected void | dropTable(String tableName) Delete table from XML file. | public ArrayList | getTableProperties(String tableName) Gets table properties in form ArrayList.
ArrayList[0] is string array with ALL column names in table.
ArrayList[1] is string array with colmn names which are PRIMARYKEYs.
ArrayList[2] is string array with colmn names which can not be NULL.
If table has no CREATE TABLE statement , ArrayList[1] will have value "NO CREATE TABLE"
Parameters: tableName - name of table. | protected void | insert(String tableName, String[] columnNames, String[] columnValues) Insert row in XML file. | protected void | saveDOM() Save DOM as XML file. | protected void | update(String tableName, String[] columnNames, String[] columnValues, String[] whereColumnNames, String[] whereColumnValues) Update row in in XML file. |
searchDocumentStatic | public static SearchElement searchDocumentStatic(Code) | | Document made from XML file, and in which will
be made changes.Document will be saved in XML file.
|
XmlWriter | public XmlWriter(String fileName, boolean isAutoCommit) throws SQLException(Code) | | Constructor used when autoCommit is set to false or true.
Parameters: fileName - name of xml file. Parameters: isAutoCommit - define is mod auto commit or not. |
commit | public static void commit(String fileName) throws SQLException(Code) | | Method is used for saving DOM in xml file from connection object,when XmlConnection.commit() method
is called.
Parameters: fileName - full path of xml file. throws: SQLException - |
createTable | protected void createTable(String sqlStatement, String tableName) throws SQLException(Code) | | Adds sql statement CREATE TABLE in XML file.
Method will throw SQLException with appropriate message if table already exist
Parameters: sqlStatement - CREATE TABLE statement which will be add into XML file Parameters: tableName - name of table which will be created throws: SQLException - |
delete | protected void delete(String tableName, String[] whereColumnNames, String[] whereColumnValues) throws SQLException(Code) | | Delete row(s) from XML file.
Parameters: tableName - name of table from which will be deleted rows. Parameters: whereColumnNames - names of columns in WHERE clause. Parameters: whereColumnValues - values of columns in WHERE clause. throws: SQLException - |
dropTable | protected void dropTable(String tableName) throws SQLException(Code) | | Delete table from XML file.
Parameters: tableName - name of table which will be deleted. throws: SQLException - |
getTableProperties | public ArrayList getTableProperties(String tableName) throws SQLException(Code) | | Gets table properties in form ArrayList.
ArrayList[0] is string array with ALL column names in table.
ArrayList[1] is string array with colmn names which are PRIMARYKEYs.
ArrayList[2] is string array with colmn names which can not be NULL.
If table has no CREATE TABLE statement , ArrayList[1] will have value "NO CREATE TABLE"
Parameters: tableName - name of table. list of table properties. throws: SQLException - |
insert | protected void insert(String tableName, String[] columnNames, String[] columnValues) throws SQLException(Code) | | Insert row in XML file.
Parameters: tableName - name of table in which will be added rows. Parameters: columnNames - names of columns in which will be added data. Parameters: columnValues - value which will be insert into table. throws: SQLException - |
update | protected void update(String tableName, String[] columnNames, String[] columnValues, String[] whereColumnNames, String[] whereColumnValues) throws SQLException(Code) | | Update row in in XML file.
Parameters: tableName - name of table which will be updatad. Parameters: columnNames - names of columns in which will be added data. Parameters: columnValues - value which will be insert into table. Parameters: whereColumnNames - names of columns in WHERE clause. Parameters: whereColumnValues - values of columns in WHERE clause. throws: SQLException - |
|
|