I am working on eXist database, I am have a new Idea that I have to implement XML file using XQuery.
I want to convert CSV file to XML which is already in the database collection. And this XML file contains only necessary tags and information. And this converted data will be saved into XML in eXist Database.
XML like this: its name is 'createXML.xml'
<?xml version="1.0" encoding="UTF-8"?>
<records>
// All the Records from CSV file want to put here..... between Records tags
</records>
now the CSV file like this:
name,subject,marks //header lines
krunal,maths,95
abc,sub1,87
def,sub2,67
...
Output like this
<?xml version="1.0" encoding="UTF-8"?>
<records>
<user>
<name>krunal</name>
<subject>maths</subject>
<marks>95</marks>
</user>
<user>
<name>abc</name>
<subject>sub1</subject>
<marks>87</marks>
</user>
<user>
<name>def</name>
<subject>sub2</subject>
<marks>67</marks>
</user>
.
.
.
</records>
Can anyone provide me how to add CSV data to already available XML using XQuery in eXist database and performs this function.