Click to See Complete Forum and Search --> : From database to xml


ocemy
03-30-2009, 04:48 PM
I stored an xml file in database and I need the reverse now. I have 3 tables in my database

attributes(name,value,parent)
elements(name,parent)
texts(text,parent)

Now I need to create an xml file from these tables. I have the original xml files. For example

<bookstore>
<book id="1">
<name>XML</name>
</book>
<book id="2">
<name>Java</name>
</book>
</bookstore>

I have 2 name element in elements table and "XML", "Java" texts in texts table. Parents of these texts are name but I have no clue about which text belongs to which name element. Also same problem exists for attributes. How can I bind these values together and create a correct element for example:

<book id="2">
<name>Java</name>
</book>

For example if there is something like familyid property that applies all the nodes under a specified node then maybe I can use it.