cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joerg Heinicke <joerg.heini...@gmx.de>
Subject Re: Adding date and time to a xml file
Date Sat, 15 Jan 2005 15:22:38 GMT
On 15.01.2005 14:28, lincoln wrote:

> I have a form that once submitted will append data to the end of an XML
> file. I also need to append the date and time that this data was added. eg:
> <root>
>   <data>
>     <dateTime>Thur...</dateTime>
>     <x>...</x>
>     <y>...</y>
>     <z>..</z>
>   </data>
>   <data>
>     <dateTime>Fri...</dateTime>
>     <x>...</x>
>     <y>...</y>
>     <z>..</z>
>   </data>
>   <data>
>     <dateTime>Sat...</dateTime>
>     <x>...</x>
>     <y>...</y>
>     <z>..</z>
>   </data>
>   ...
> </root>
> 
> My code is based on the xml binding sample block and am trying to add this

I guess you mean CForms?

> XSP code to get the date and time (works in isolation):
> <xsp:page xmlns:xsp="http://apache.org/xsp"> 
> 	<date><xsp:expr>new Date()</xsp:expr></date> 
> </xsp:page>
> I have heard you can generate a date in the sitemap.xmap somehow, is that
> true and is it a better approach?
> 
> If I do use XSP then I can't see how this binds to the xml file, at a guess
> I believe I would need to modify the sitemap somehow.

Don't use XSP at all. Add a fd:output with datatype date to your form 
definition, but not into the template. Immediately before saving the 
form set the value of the field to "new Packages.java.util.Date()".

Joerg

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


Mime
View raw message