cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Lundquist ...@wrinkledog.com>
Subject Re: Adding date and time to a xml file
Date Mon, 17 Jan 2005 18:33:09 GMT

On Jan 15, 2005, at 7:22 AM, Joerg Heinicke wrote:

> 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()".

Hmmm, the OP wrote that when the form is submitted, he wants to add to 
append to the XML file: (1) data from the form, and (2) a timestamp.  
But putting the timestamp into the form seems roundabout!! :-)  The 
timestamp has nothing to do w/ the form...

-ml-


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


Mime
View raw message