SQL queries expressed in XML

Julian Reschke reschke at medicaldataservice.de
Tue Mar 23 11:50:51 GMT 1999

Andrew McNaughton <andrew at squiz.co.nz> wrote:

> > > we recently had the idea to use XML to express SQL-like queries
> > > (so this is
> > > not about querying XML -- it is about using XML to express queries).
> > > seems to me that we might not be the first ones; so has anybody
defined an
> > > XML document type for expressing SQL queries?
> >
> > And just to widen this question slightly - assuming I do have an XML
> > representation
> > of a language construct - whats the best way to do the conversion from
> > the XML representation to the 'correct' language representation.
> >
> > Could I use XSL to do this - or would this be going against the grain?
> >
> > (Just to qualify this I'm relatively new to XML, and *extremely* new to
> > XSL).
> XSL doesn't seem to do very well where the desired output is not well
> If your SQL queries have '"', '<', '>' or '&' in them, then you're going
> start getting into kludges.  perl or DSSSL would be better suited to the
> *Why* do you want to put your queries into XML?  Do you need access to the
> structure of your queries?  Perhaps you just need something that can be

The idea was to reuse XML tools in a project which is XML related anyway.
Expressing a query in XML instead of using a "proprietary" representation
would allow us to use a standard parser to transform it into a object
representation (DOM), and it would also have the benefit that standard tools
could be used to actually enter or render a query string.

> ...
> I figure any boolean query can be expressed as a decision tree terminating
> true or false leaf nodes, that this maps well into XML, and that it should
> able to be used to search for queries matching a given document using
> tools (eg sgrep).  I believe this could lead to a relatively simple
> model, but it remains to be seen how efficient it will be.

Basically this is similar to our thinking...

> If anyone is aware of any relevant work that is being or has been done I'd
> appreciate hearing about it.  XML or otherwise.

This is precisely why I asked :-)

Julian Reschke
MedicalData Service GmbH (http://www.medicaldataservice.de)

xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)

More information about the Xml-dev mailing list