Class TableToXML
java.lang.Object
lukas.wais.smart.mirror.controller.DBController
lukas.wais.smart.mirror.controller.TableToXML
public class TableToXML extends DBController
The Class TableToXML contains the methods for creating/saving the database
structure and the already existing data.
-
Constructor Summary
Constructors Constructor Description TableToXML()
-
Method Summary
Modifier and Type Method Description org.w3c.dom.Document
generateXML(java.lang.String table)
Generate an XML file according to the given table as an input parameter.static void
xmlToTable(org.w3c.dom.Document doc)
With this function the database structure will be created base on an XML file.
-
Constructor Details
-
TableToXML
public TableToXML()
-
-
Method Details
-
generateXML
public org.w3c.dom.Document generateXML(java.lang.String table) throws javax.xml.parsers.ParserConfigurationExceptionGenerate an XML file according to the given table as an input parameter. The file contains the tag for each column as well as the format for each table field and the corresponding data if exists.- Parameters:
table
- which table should be extract from the database- Returns:
- document with the table data
- Throws:
javax.xml.parsers.ParserConfigurationException
- the parser configuration exception
-
xmlToTable
public static void xmlToTable(org.w3c.dom.Document doc) throws java.sql.SQLExceptionWith this function the database structure will be created base on an XML file. The XML contain the table structure and data to be inserted. In case the table already exists in the database only the data for the corresponding table fields will be inserted.- Parameters:
doc
- is the input parameter with the XML file and structure- Throws:
java.sql.SQLException
- the SQL exception in case the connection to the database is not possible
-