[xquery-talk] SQL to XML with XQuery?
xquery at docbook-autor.de
xquery at docbook-autor.de
Wed Aug 9 23:07:55 PDT 2017
Hi,
I know that XQuery is typically used for transforming XML into other
text file formats.
But is it possible to use XQuery for the other way round?
I want to transform a very simple SQL Create Table statement into XML.
SQL
===
CREATE TABLE mytable1
(
FIELD1 xxx;
FIELD2 xxx;
FIELD3 xxx;
);
COMMENT ON COLUMN mytable1.FIELD1 'Description1';
COMMENT ON COLUMN mytable1.FIELD2 'Description2';
CREATE TABLE mytable2
(
FIELD1 xxx;
FIELD2 xxx;
FIELD3 xxx;
);
COMMENT ON COLUMN mytable2.FIELD1 'Description1';
COMMENT ON COLUMN mytable2.FIELD3 'Description3';
XML
===
<table>
<title>mytable1</title>
<column>
<name>FIELD1</name>
<comment>Description1</comment>
</column>
<column>
<name>FIELD2</name>
<comment>Description2</comment>
</column>
<column>
<name>FIELD1</name>
<comment></comment>
</column>
</table>
<table>
<title>mytable2</title>
<column>
<name>FIELD1</name>
<comment>Description1</comment>
</column>
<column>
<name>FIELD2</name>
<comment></comment>
</column>
<column>
<name>FIELD1</name>
<comment>Description3</comment>
</column>
</table>
Can this be done via XQuery? If not which tool could possibly fit my needs?
Best regards
Michael
More information about the talk
mailing list