dbsql2xml

Download of sources, executables and support forum are on dbsql2xml project page on SourceForge.net.

See ChangeLog.

"dbsql2xml" is Java tool (class) for transformation (export, convert) relational database into hierarchical XML. It requires JRE 5.0, JDBC and SQL DBMS. "dbsql2xml" uses XML document for mapping database tables and columns into elements of tree XML

What means HIERARCHICAL OR in other words TREE STRUCTURE OUTPUT?

Look at example of flat (one-level deep) XML.

example of flat XML

Well, such XML output degenerates sence of XML. It also degenerates database structure (normalisation) expressed by ERA and whole object approach to data. Have a look on another example - the same data, but tree (hierarchical, multi-level deep) XML.

example of tree XML

This example preserves object approach to data (in database known as 1., 2., 3. normalisation).

"dbsql2xml" is a Java tool, which exports data from any relational database using SQL with JDBC to tree XML. To say "dbsql2xml" how to map each table with its column into XML elements, "dbsql2xml" needs to have mapping XML file. Mapping XML file is tree XML – something like mask or RegExp patters of future XML tree output. "dbsql2xml" can produce both flat and tree structured XML. Let have a look on example of tree mapping XML.

example of tree mapping XML

example of fully commented tree mapping XML with XInclude and charset encoding START READING THIS MAPPING FILE

And now You can see example of flat mapping XML, if You want to produce it.

example of flat mapping XML

Each good XML document should have its XML Schema. For mapping XML XMl Schema see

XML Schema of mapping XML

These examples above are included in distribution of "dbsql2xml". "exampleOfUse.java", also in the distribution, contains these two mapping files (tree and flat) and running "exampleOfUse" will produce eight (four for tree and four for flat structure) outputs. Since version 0.3, "dbsql2xml" outputs transformation into four targets:

java.io.File
for standalone export (transformation, extraction) application
java.lang.String
rather for debugging purposes on Mac OS
org.w3c.dom.Document
as a part of any other sever or desktop program (e.g. servlet)
System.out
for debuggin purposes

Output to all targets are in UTF-8. Because output can be done into String and Document, "dbsql2xml" can be easily used inside servlets. Servlet example is included in the distribution since version 0.5.

"dbsql2xml" is young Java class, so any questions, suggestions or any other feedback is welcome. Use Forum -> Help for it.

Download of sources, executables and support forum are on dbsql2xml project page on SourceForge.net.

Stepan