You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Jeremy Quinn <je...@media.demon.co.uk> on 2002/11/27 11:44:08 UTC

Parsing XML from SQL

Dear All

We are using the SQLTransformer for a project.

Our SQL Database contains a Table called Resource, which keeps 
information about the resources in our archive. Most of these resources 
are binary, ie. .gif, .jpg, .swf, .mov etc. So we merely 'embed' the 
resource reference in the page produced by a Resource record, to show 
it on the page.

We now find we have a few 'text' resources, that require a bit of 
markup in them, mainly just paragraphs.

We either need to XInclude the resource into the pipeline from an XML 
file referred to in the SQL, or keep the actual resource in the SQL and 
parse it as it comes out.

I know that it is possible to parse SQL fields via the ESQL TagLib, but 
we prefer the Transformer approach.

Does anyone know if it is possible to Parse fields extracted from SQL 
via the SQLTransformer?


Thanks for any suggestions.

regards Jeremy


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Parsing XML from SQL

Posted by Jeremy Quinn <je...@media.demon.co.uk>.
On Thursday, Nov 28, 2002, at 06:49 Europe/London, Gabriele Domenichini 
wrote:

> Your problem is not simple. If I've understood you have resources 
> record made like this:
> something.jpg | somewhere/somethingelse.mov | resourceFound.txt |

There is currently a field that holds a url snippet to the resource, as 
your example.
This makes perfect sense for binary assets that are loaded directly by 
the browser, we can just embed the asset.

With marked up text, however we do not have this simple ability to 
embed using the browser (unless we use iframe or something like that !).

I am looking at the possibility of storing the xml markup in an SQL 
field, but it would have to be parsed before it was useful.

>
> Well if this is the point, I think the best way to act is to make some 
> xslt transformation after the sql transformation.

Yes, I can invoke C/XInclude to do the job, but wanted to find a less 
clumsy way of handling it, other wise all 'resources' will have to have 
C/XInclude in their pipeline regardless of whether it is needed or not, 
as you cannot tell in advance what type a particular resource will be.



> I don't have experiences about parsing text but I think the text 
> generator do such a thing.

A Generator is no good, we are past the Generation stage by the time we 
get the output of the SQL Query.

I used the Generation step to aggregate the page framework, SQL 
'Macros', Site menus etc.

Anyhow I believe the TextGenerator is for parsing non-XML languages 
into XML.

> If you have to make estraction and elaboration before aggregation I 
> would use cinclude instead xinclude. The main difference between the 
> is the two is the possibility of cinclude to invoke a  specific 
> pipeline (so a transformation) as source with the protocol "cocoon:/".
> I find this very powerfull even if a little proprietary  ;-)

We don't need internal pipelines for this ..... I have moved to avoid 
CIncluding internal pipelines since I found Caching does not work 
properly with them in 2.1


>
> I agree with the orientation of avoiding esql where possible, and I 
> think that here it doesn't help a lot
> Sorry if I'm not specific but I should know the project and even so it 
> would take me time. I hope to have been useful somehow

well, thanks for your response

regards Jeremy


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Parsing XML from SQL

Posted by Gabriele Domenichini <ga...@fastmail.fm>.
Your problem is not simple. If I've understood you have resources record 
made like this:
something.jpg | somewhere/somethingelse.mov | resourceFound.txt |

Well if this is the point, I think the best way to act is to make some 
xslt transformation after the sql transformation.
I don't have experiences about parsing text but I think the text 
generator do such a thing.
If you have to make estraction and elaboration before aggregation I 
would use cinclude instead xinclude. The main difference between the is 
the two is the possibility of cinclude to invoke a  specific pipeline 
(so a transformation) as source with the protocol "cocoon:/".
I find this very powerfull even if a little proprietary  ;-)

I agree with the orientation of avoiding esql where possible, and I 
think that here it doesn't help a lot
Sorry if I'm not specific but I should know the project and even so it 
would take me time. I hope to have been useful somehow

Jeremy Quinn wrote:

> Dear All
>
> We are using the SQLTransformer for a project.
>
> Our SQL Database contains a Table called Resource, which keeps 
> information about the resources in our archive. Most of these 
> resources are binary, ie. .gif, .jpg, .swf, .mov etc. So we merely 
> 'embed' the resource reference in the page produced by a Resource 
> record, to show it on the page.
>
> We now find we have a few 'text' resources, that require a bit of 
> markup in them, mainly just paragraphs.
>
> We either need to XInclude the resource into the pipeline from an XML 
> file referred to in the SQL, or keep the actual resource in the SQL 
> and parse it as it comes out.
>
> I know that it is possible to parse SQL fields via the ESQL TagLib, 
> but we prefer the Transformer approach.
>
> Does anyone know if it is possible to Parse fields extracted from SQL 
> via the SQLTransformer?
>
>
> Thanks for any suggestions.
>
> regards Jeremy 






>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>
>



---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>