#63 XML Output Of A Query

open
nobody
None
5
2006-10-31
2003-05-12
KosherJava
No

The following request is more of an idea in incubation
than an RFE.
It can be used in a plugin or in the core.
The ability to have the results of a query as an XML
document can be very helpful especially when a
developer plans on having the final output transformed
using xslt. usually the developer will construct an xml
document from the RS in the format he wants and then
have it transformed using xslt.
Constructing an xml document from a RS is typically
very simple. Had SQuirreL still been using JDOM as in
the past it would have been as simple as:

Statement stmt = connection.createStatement();
ResultSet rs = stmt.executeQuery("select COL_1,
COL_2 from table");
ResultSetBuilder builder = new ResultSetBuilder(rs);
Document doc = builder.build();

But even though SQuirreL is not using JDOM anymore it
can simply be built using String concatenation (actually
StringBuffer). Since the document should always have
the same output format there would be little reason to
validate the document. One thing that would have to be
done would be to escape non valid xml (such as <, >
etc) from the data.
The memory overhead for this would probably be much
smaller than using JDOM in any case.

Part 2:
Since the format of the output XML would not be very
configerable (why make things more complex than
necessary) an simple XSLT stylesheet can be written by
any developer to transform the JDOM/SQuirreL/Other
xml format to the format that the actual final stylesheet
would expect. This formatted XML could then be
transformed against the regular XSLT used by the user
for testing. This 2 step transformation is common and
very usefull in our case. JDOM (B8 and B9) directly
support transformations making this not very complex.
I can imagine the xml output tab having 4 subtabs.
1) the raw xml created from the RS
2) the optional xml format converter xslt
3)the stylesheet to be used for the transformation
4) the resulting output of the transformation

One side benefit of the use of xml ouput would be the
ability to have canned xslt that gave the output as csv
(in different flavors if needed) or almost any text based
representation) standard xhtml/html output of a table
can also very easily be outputted using simple
stylesheets.
Alternatly (or in addition) there can be some way of
plugging the results directly into an other 3rd part tool.
One that comes to mind is the Treebeard xslt tool
http://treebeard.sourceforge.net/index.php

Discussion

  • Colin Bell

    Colin Bell - 2003-05-28
    • assigned_to: nobody --> patrickconnors
     
  • Colin Bell

    Colin Bell - 2006-10-31
    • assigned_to: patrickconnors --> nobody
     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks