Subject | Re: [firebird-support] Re: Firebird SQL extract to XML: Possible? |
---|---|
Author | Michael Ludwig |
Post date | 2011-03-23T20:37:57Z |
karolbieniaszewski schrieb am 22.03.2011 um 06:59 (-0000):
reserved character.
Don't reinvent the wheel. You have database drivers that are good at
fetching data from the database, and you have XML producing libraries
that will produce the XML for you. All you have to do is to wire them
up and you're done.
Example for Perl:
* DBD::InterBase
* XML::LibXML
If you've got reasonable column names throughout (legal XML names), you
just reuse them as element names. Else give your elements boring names
such as <col name="my stupid column name with whitespace">.
Probably about 20 lines of code to write.
--
Michael Ludwig
> XML is text based then write text concatenationThis approach will fall flat on its face at the first occurrence of a
>
> SELECT
> '<element>' ||
> '<bar> || f.foo || '</bar>' ||
> '</element>'
> FROM DBTable f
> WHERE f.ID="fooid"
reserved character.
> of course simplest is write stored proc for this with combination ofThis won't solve the fundamental problem of producing proper XML.
> execute statement
Don't reinvent the wheel. You have database drivers that are good at
fetching data from the database, and you have XML producing libraries
that will produce the XML for you. All you have to do is to wire them
up and you're done.
Example for Perl:
* DBD::InterBase
* XML::LibXML
If you've got reasonable column names throughout (legal XML names), you
just reuse them as element names. Else give your elements boring names
such as <col name="my stupid column name with whitespace">.
Probably about 20 lines of code to write.
--
Michael Ludwig