cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mustafa Yalniz" <>
Subject Re: problem saving sunshine profiles in database
Date Mon, 09 Jun 2003 12:07:39 GMT
Hi Enrico,

I have the same problem. I have tried using the similar approach that
have taken but seems something is wrong in copying into the database.
tags disappear in the database even if they are in the log file before

Any help would be greatly appreciated.

Best regards,

-----Original Message-----
From: Enrico Ballarin Dolfin [] 
Date: 05 June 2003 Thursday 11:57
To: Cocoon Users
Subject: problem saving sunshine profiles in database


I'm using Cocoon 2.0.4 with Tomcat 4.0.4, Apache 1.3.26 and Java 1.3.1.

After having modified the sunspotdemoportal to perform authentication
with a
database instead of with files, I'm trying now to solve the next problem
i.e. how to store user profile and status on the database instead to
a lot of files on the system.

I added to my user table in mysql the two fields profile and
status of type TEXT (till max 65536 characters each).

After this I added following resource in the sitemap:

        <map:match pattern="vipresource-saveuserprofile">
          <map:generate src="vip/resources/saveuserprofile-db.xml"/>
          <map:transform type="sunShine"/>
          <map:transform src="vip/styles/saveuserprofile-db.xsl"/>
          <map:transform type="sql"/>
          <map:transform src="vip/styles/saveuserprofile-sql.xsl"/>
          <map:serialize type="xml"/>

This is the file saveuserprofile-db.xml:

<?xml version="1.0"?> <!-- saveuserprofile-db.xml -->

<userdelta xmlns:sunshine="">
  <name><sunshine:getxml context="request" path="/parameter/ID"/></name>
  <fragment><sunshine:getxml context="request"

After the generator and the sunShine transformer I get the <name> and
<fragment> elements filled with the current values and I'm trying to put
them in a SQL statement with following stylesheet:

<?xml version="1.0"?> <!-- saveuserprofile-db.xsl -->
<xsl:stylesheet version="1.0"

<xsl:template match="userdelta">
    <sql:execute-query xmlns:sql="">
        update user_tb
           set profile = '<xsl:copy-of select="fragment"/>'
           where name = '<xsl:value-of select="name"/>'


The file saveuserprofile-sql.xsl for postprocessing the results of the
query is not relevant and I have omitted it in this mail.

Looking in the logfile I can see that there is an item with the sql
statement with substituted values for profile and name, where profile
contains the xml tree in the desired form. The following item in the
shows the same statement where the profile content is no more the xml
but only the text part of it with a lot of blank lines and without any
element tags.

If I look at the stored values in the database I see exactly this last
content without element tags.

Here a simplified test showing a similar extract from the logfile:

2003-06-04 16:51:44 DEBUG   (2003-06-04) 16:51.44:156   [sitemap.]
HttpProcessor[8080][10]/AbstractSAXTransformer: END endRecording
fragment=<?xml version="1.0" encoding="ISO-8859-1"?>
        update user_tb
           set profile = '<fragment
<myelement>The value</myelement>
           where name = 'test'

2003-06-04 16:51:44 DEBUG   (2003-06-04) 16:51.44:165   [sitemap.]
HttpProcessor[8080][10]/AbstractSAXTransformer: END
endSerializedXMLRecording xml=
        update user_tb
           set profile = 'The value'
           where name = 'test'

The other way would be to analyze which are the contents of status and
profile and map them to database tables, what I think can be very
and preferably to avoid.


1) How can I store an user profile and status on the database?
2) Is there an easier way to solve it and to avoid a large number of
3) Beside this, there is the problem to escape characters like
apostrophs or
german umlauts. How can be done this?

Thanks for your opinions and suggestions

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message