cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sven Beauprez" <Sven.Beaup...@xume.be>
Subject RE: SQLTransformer doesn´t output namespace prefixes?
Date Mon, 08 Oct 2001 17:45:33 GMT

I don't completely agree with tomK (again :-) ). The purpose of the SQLTransformer is to execute

a sql statement and to give back the result transparantly to the next level/stage (eg transformer).

In this new stage, it should not be relevant where the XML comes from, and if you put sql-prefix

in the result, you more or less say that the data comes from a DB, while it could also come
from 
something totally different (another server for instance when you use B2B).
The sql-prefix has to be present in the XML that will be parsed by the sqltransformer, because

elements with this prefix contain 'commands' for the sql transformer and only for the 
sqltransformer. So the only reason why you need the sql-prefix again is when you want to 
execute the sql-transformer again, - immediately - after the first one (this should mean you
read 
sql statements from the DB ?!? IMO a very rare case. This is - not - the same as in your case!).
There are still 2 possibilities in your case:
- you let the sqltransformer do the work (thus add the sql-prefix in stage 2 in your pipeline)
- you do it in the xslt transform (thus add the sql-prefix in stage 3 in your pipeline)

IMHO you should add the sql-prefix in stage 3, because here you make preperations for the
new 
queries, thus it is his responsibility that the input for the next instance of the sqltransformer
is 
correct.
So I strongly suggest you don't 'just forward' the sql prefix. If you really need a prefix
(in your 
case, you need one that will be translated to the sql prefix in the 3rd stage in your pipeline),
you 
have to be able to configure it for instance in the sitemap. Then you read this variable in
the 
relevant sax-methods and forward the elements with the given prefix. If you want to implement

this feature (which I encourage of course ;-) ), make it optional, so that if someone doesn't

configure the prefix, no prefix is added to resulting elements...


Sven


PS: it is true that i don't read the mailinglists that often anymore (new projects, new priorities),

but I will try to find some time the next few days to answer your questions...


On 8 Oct 2001 at 9:41, Tom Klaasen (TeleRelay) wrote:

> 
> Per-Olof (or is it Norén?),
> 
> AFAIK, Sven (in cc, because I don't know he's still on the list) and I have made
> the latest changes to the SQLTransformer with the help of Vadim and dims. I for
> one haven't touched the ContentHandler interface of SQLTransformer, but I
> suspect Sven did. I also suspect that the prefix-handling wasn't done simply
> because we didn't need it. So go ahead, there's no objection to implementing
> stuff others were too lazy to do ;-)
> 
> hth,
> tomK
> 
> 
> -----Original Message-----
> From: Per-Olof Norén [mailto:pelle@alma.nu] 
> Sent: donderdag 4 oktober 2001 19:05
> To: cocoon-dev@xml.apache.org
> Subject: SQLTransformer doesn´t output namespace prefixes?
> 
> Hi,
> I´m currently implementing a kind of "backend" pipeline for a cocoon.
> The concept is a xml based command language thatencapsulates and "objectifies"
> the underlying relational database model.
> 
> pipeline:
> 1. xslt transform ( parsing the criteria part of the command into sql query) 2.
> sql transformer 3. xslt transform (parsing the extent ie data to view, and
> creating queries) 4. sql transformer 5. xslt (creating the response)
> 
> protocol is something like this:
> 
> initial file looks something like this:
> 
> <cmd:command>
> <cmd:criteria>
> <cmd:criterion type="type">value</cmd:criterion>
> </cmd:criteria>
> <cmd:extents>
> <cmd:extent type="type">parameter</cmd:extent>
> <cmd:extents>
> </cmd:command>
> 
> after xslt transformation
> 
> <cmd:command>
> <sql:execute-query>
> <sql:doc-element>objects</sql:doc-element>
> <sql:row-element>object</sql:row-element>
> 
> <sql:query>THE QUERY </sql:query>
> </sql:execute-query>
> <cmd:extents>
> <cmd:extent type="type">parameter</cmd:extent>
> <cmd:extents>
> </cmd:command>
> 
> after sql transformer:
> 
> <cmd:command> 
> <objects>
> <object>...</object>
> <objects>
> <cmd:extents>
> <cmd:extent type="type">parameter</cmd:extent>
> <cmd:extents>
> </cmd:command>
> 
> 
> No sql prefix is outputted on the objects tag!The outputted namespace uri is
> correct, though Looking into the code of the SQLTransformer one detects that
> there is no implementation of the start- and endPrefixMapping. To my knowledge,
> there is no way of knowing the prefix to output if the start- and
> endPrefixMapping methods aren´t implemented?
> 
> Is there a design reason for not to output prefixes?
> If there is, please let me know.
> I will probably implement the prefix outputting mechanism if there is no reason.
> 
> Thx in advance
> Per-Olof Norén
> Stockholm, Sweden
> 
> 
> 
> 
> 
> 
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


Mime
View raw message