Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert database tables into xml files without using a programming language

Tags:

xml

I want to convert schema table relations into xml file without using a programming language. I just want to how how it works. Below are my database tables.

User(id, name, address)
     10  john  ca
     20  marsh ny 

Account(aid, title, balance, id)
         1   john   2000     10
         2   marsh  3000     20

Transaction(tid, date, amount, type, aid)
            100  1feb  500     Dr    1
            300  3mar  100     Cr    2 

Click this link to view all the schema tables: http://www.mediafire.com/view/?eu9ggoei7py2efr

Please check the above link to view all of my tables as i don't have greater than 10 points to upload an image here, so please check the link to view my tables. Should i make individual xml file for individual table? I'm really stuck at this point. The table which prints the transaction is more complicated. Please give me some suggestions. Thanks

Should i make three individual xml files for each table or just one??

<?xml version="1.0" ?>
<user>
<id>10</id>
<name>john</name>
<address>ca</address>

<id>20</id>
<name>marsh</name>
<address>ny</address>
</user>



<?xml version="1.0" ?>
<account>
<aid>1</aid>
<title>john</title>
<balance>2000</balance>
<id>10</id>

<aid>2</aid>
<title>marsh</title>
<balance>3000</balance>
<id>20</id>
</account>


<?xml version="1.0" ?>
<transaction>
<tid>100</tid>
<date>1feb</date>
<amount>500</amount>
<type>Dr</type>
<aid>1</aid>

<tid>300</tid>
<date>3mar</date>
<amount>100</amount>
<type>Cr</type>
<aid>2</aid>

</transaction>
like image 529
Sid Chaudhry Avatar asked Jun 08 '26 09:06

Sid Chaudhry


1 Answers

You should be able to find some tools online that can do this, especially with the interest in XML databases a while back.

Here are two links to get you started:

A tool with a feature that can do this: http://www.oxygenxml.com/xml_editor/database_to_schema.html

A discussion relating to this, albeit for SQL-server: Get XML schema from database schema (SQL Server 2008 diagram)

If you include your platform, more help may be possible.

EDIT

From your response, it sounds like you just want an idea of how you should set up the fields in your XML. The short answer is any way you want to. The longer answer is it depends on what you want to feed the XML to.

You could try to do your mappings according to this proposal: http://www.w3.org/1999/07/20-XML-DB-Mapping

If you just want an idea of how you could represent a database schema in XML, then something like the below can work for your Account table. For illustrative purposes, I'm pretending aid is your primary key and id is a foreign key that links with Transaction.tid:

<dbTable name="Account">
   <column name="aid" type="int" primaryKeyKey="true" />
   <column name="title" type="varchar(255)" />
   <column name="balance" type="float" />
   <column name="id" type="int" foreignKey="Transaction.tid" />
</dbTable>
like image 141
RonaldBarzell Avatar answered Jun 10 '26 07:06

RonaldBarzell