You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Alan Stenhouse <ex...@wireless-vision.de> on 2001/01/31 13:41:04 UTC
get-xml and embedded tags in DB fld solution
Hi there
Just passing on our solution for getting data from a DB which contains
embedded tags.
We do (accessing a mySQL DB) something like:
<esql:execute-query>
<esql:use-connection>default</esql:use-connection>
<esql:query>select
concat('<ggg>',myFldWithTags,'</ggg>') as D2 from myTable
where my_ID=34;
</esql:query>
<esql:results>
<p><esql:get-xml column="D2"/></p>
</esql:results>
</esql:execute-query>
The main thing that is happening here is that we're surrounding the
particular field with a set of tags, so that the resulting output will
be a well-formed branch. It doesn't seem to matter what exactly the tags
are, hence the nonsensical ones (<ggg> and </ggg>) above.
NOTE that for the embedded tags to be processed correctly you'll
probably need an entry for them in your XSL sheet.
HTH
Alan
Re: get-xml and embedded tags in DB fld solution
Posted by Donald Ball <ba...@webslingerZ.com>.
On Wed, 31 Jan 2001, Alan Stenhouse wrote:
> Just passing on our solution for getting data from a DB which contains
> embedded tags.
>
> We do (accessing a mySQL DB) something like:
>
> <esql:execute-query>
> <esql:use-connection>default</esql:use-connection>
> <esql:query>select
> concat('<ggg>',myFldWithTags,'</ggg>') as D2 from myTable
> where my_ID=34;
> </esql:query>
> <esql:results>
> <p><esql:get-xml column="D2"/></p>
> </esql:results>
> </esql:execute-query>
>
>
> The main thing that is happening here is that we're surrounding the
> particular field with a set of tags, so that the resulting output will
> be a well-formed branch. It doesn't seem to matter what exactly the tags
> are, hence the nonsensical ones (<ggg> and </ggg>) above.
>
> NOTE that for the embedded tags to be processed correctly you'll
> probably need an entry for them in your XSL sheet.
note there's support for this already in esql. try
<esql:get-xml column="D2" root="ggg"/>
to automatically wrap the column's data with a ggg root element. i've
considered writing something to automatically strip the nonsense element
to make it easier to include xml fragments seamlessly.
- donald