I am trying to make the bible available in some versions of translations for a presentation software that uses files in .xml format.
I want to create xml file of this structure:
<Bible>
<book name="Gênesis" abbrev="gn" nchapters="50" >
<chapter n="1">
<verse n="1"> No princípio criou Deus o céu e a terra.</verse>
<verse n="2"> A terra era sem forma e vazia; [...] a face das águas.</verse>
<verse n="3"> Disse Deus: haja luz. E houve luz.</verse>
</chapter>
<chapter n="2">
[...]
</book>
<book name="Êxodo" abbrev="êx" nchapters="40" >
<chapter n="1">
<verse n="1"> No princípio criou Deus o céu e a terra.</verse>
<verse n="2"> A terra era sem forma e vazia; [...] a face das águas.</verse>
<verse n="3"> Disse Deus: haja luz. E houve luz.</verse>
</chapter>
<chapter n="2">
[...]
</book>
[...]
</Bible>
I have 2 tables: "Books", " Verses".
Books
| Book_id | name | abbrev | nchapters |
|---|---|---|---|
| 1 | Gênesis | Gn | 50 |
| 2 | Êxodo | Êx | 40 |
| ... | ... | ... | ... |
Verses
| id | book | chapter | verse | text |
|---|---|---|---|---|
| 1 | Gênesis | 1 | 1 | No princípio criou Deus os céus... |
| 2 | Gênesis | 1 | 2 | E a terra era sem forma e vazia... |
| ... | ... | ... | ... | ... |
| 1534 | Êxodo | 1 | 1 | Estes pois são os nomes dos filhos... |
I am not able to write a code in the SQL query that generates this structure. Any help in getting code that solves this question will be highly appreciated.
Thanks!