logo       
Google Custom Search
    AddThis Social Bookmark Button
-->

Re: <program> tag (again): msg#00002

Subject: Re: <program> tag (again)
Hi Ken, here's another quick response :)

try using <o:do> instead of the program tag, something like this:

<o:do xmlns:o="http://www.o-xml.org/lang/";>

... your program

</o:do>

the o:do elements don't get copied to the result, and so can be used to
wrap other elements without producing output.

The limitation here is that the program itself must be a valid XML file.
The output may be an XML fragment, and so does not have to have an XML
declaration or a single root element - unless you want to do further XML
processing on it.

> Also, I know o:xml is designed to generate XML as output. But if you can
> suppress the xml version/encoding specification and program tag and just
> generate plain text, you can use the database extensions to generate CSV
> files, which would be quite handy.

I've not really thought about using o:XML to generate text, but I guess
that XML fragments can be plain Unicode text.

[off to try it out]

<o:do xmlns:o="http://www.o-xml.org/lang/";
  xmlns:db="http://www.o-xml.com/db/";>

  <db:connection>
        ....
  </db:connection>

  <db:execute sql="select * from users">
    [name], [realname], [email]
  </db:execute>

</o:do>

it works! spacing and linefeeds might need a little tuning though.

However my recommendation would generally be to use o:XML to generate XML,
and then XSL to generate CSV from that. Using the command-line ObjectBox
(or the shell script) you can pipe the result nodes through an XSLT engine
by adding '-xsl' to the command. The ObjectBox servlet does this
automatically too.
Let me know if you want a sample xsl file to try this out with.


cheers!

/m

Martin Klang
http://www.o-xml.org - the object-oriented XML programming language


<Prev in Thread] Current Thread [Next in Thread>