x***@docbook-autor.de
2017-08-10 06:07:55 UTC
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
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk
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
_______________________________________________
***@x-query.com
http://x-query.com/mailman/listinfo/talk