You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cocoon.apache.org by Andrzej Jan Taramina <an...@chaeron.com> on 2003/11/10 03:29:15 UTC

Best way to edit XML file using Cocoon?

I'm writing an application that presents a high level UI to the users in a 
browser, but under the covers it is building/editing/modifying an XML 
document which keeps track of all the things the user wants to do.

Any advice on the best way to implement this?  

I figured on storing a DOM instance in the users session, and then using 
flowscript to control the app flow and to edit the XML DOM structure in the 
session as each user request comes in.  When the user has completed the 
workflow, I would serialize the DOM instance out into a database for storage.

Thoughts?  Suggestions?

Thx!



Andrzej Jan Taramina
Chaeron Corporation: Enterprise System Solutions
http://www.chaeron.com


Re: Woody Multiforms, Re: Best way to edit XML file using Cocoon?

Posted by Bruno Dumon <br...@outerthought.org>.
On Mon, 2003-11-10 at 13:24, Vadim Gritsenko wrote:
> Sylvain Wallez wrote:
> 
> > ... edit complex XML documents stored in BLOBs, and provide an 
> > advanced GUI that totally hides the fact that it's an XML file.
> >
> > The document is loaded in a flowscript global variable (i.e. tied to 
> > the session), and lots of woody forms modify their respective parts of 
> > this document. When finished, the user clicks a save button and the 
> > document is stored in database.
> 
> 
> Here comes a question: What's the advantage of lots of forms (with lots 
> of bindings, lots of templates) comparing to just one form, and one 
> binding, and lots of templates? :)
> 
> I found out that the only place forbidding this is readFromRequest() 
> method which cleans up value in form when it's not present in request, 
> and thus, you can't use one form with partial templates. Would it be ok 
> (wise/sane/etc) to add request parameters like  getFullyQualifiedName() 
> + ".present" to indicate presense of the widget on the form, and act 
> accordingly?

Besides Sylvain's points, another problem is that this would allow to
change the value of widgets appearing on another page by doing some URL
hacking.

-- 
Bruno Dumon                             http://outerthought.org/
Outerthought - Open Source, Java & XML Competence Support Center
bruno@outerthought.org                          bruno@apache.org


Re: Woody Multiforms, Re: Best way to edit XML file using Cocoon?

Posted by Sylvain Wallez <sy...@apache.org>.
Vadim Gritsenko wrote:

> Sylvain Wallez wrote:
>
>> ... edit complex XML documents stored in BLOBs, and provide an 
>> advanced GUI that totally hides the fact that it's an XML file.
>>
>> The document is loaded in a flowscript global variable (i.e. tied to 
>> the session), and lots of woody forms modify their respective parts 
>> of this document. When finished, the user clicks a save button and 
>> the document is stored in database.
>
>
>
> Here comes a question: What's the advantage of lots of forms (with 
> lots of bindings, lots of templates) comparing to just one form, and 
> one binding, and lots of templates? :)


This is not possible when you have repetitive structures in the XML 
document, as you use the same form on the various instances of these 
structures (e.g. on description[1], description[2], etc).

Also, a woody form won't validate if some required fiels are not filled, 
even if not shown in the template.

And finally, I'm not sure that managing a single thousand lines long 
form definition is a good thing from the project organization point of 
view ;-)

Ah, and about binding: we write it in the form definitions and not in 
separate files (see def2binding.xsl). This removes 1/3 of the files ;-)

> I found out that the only place forbidding this is readFromRequest() 
> method which cleans up value in form when it's not present in request, 
> and thus, you can't use one form with partial templates. Would it be 
> ok (wise/sane/etc) to add request parameters like  
> getFullyQualifiedName() + ".present" to indicate presense of the 
> widget on the form, and act accordingly?


Or check for getParameter(getFullyQualifiedName()) != null ?

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com



Woody Multiforms, Re: Best way to edit XML file using Cocoon?

Posted by Vadim Gritsenko <va...@verizon.net>.
Sylvain Wallez wrote:

> ... edit complex XML documents stored in BLOBs, and provide an 
> advanced GUI that totally hides the fact that it's an XML file.
>
> The document is loaded in a flowscript global variable (i.e. tied to 
> the session), and lots of woody forms modify their respective parts of 
> this document. When finished, the user clicks a save button and the 
> document is stored in database.


Here comes a question: What's the advantage of lots of forms (with lots 
of bindings, lots of templates) comparing to just one form, and one 
binding, and lots of templates? :)

I found out that the only place forbidding this is readFromRequest() 
method which cleans up value in form when it's not present in request, 
and thus, you can't use one form with partial templates. Would it be ok 
(wise/sane/etc) to add request parameters like  getFullyQualifiedName() 
+ ".present" to indicate presense of the widget on the form, and act 
accordingly?

Vadim




Re: Best way to edit XML file using Cocoon?

Posted by Sylvain Wallez <sy...@apache.org>.
Andrzej Jan Taramina wrote:

>I'm writing an application that presents a high level UI to the users in a browser, but under the covers it is building/editing/modifying an XML document which keeps track of all the things the user wants to do.
>
>Any advice on the best way to implement this?  
>
>I figured on storing a DOM instance in the users session, and then using flowscript to control the app flow and to edit the XML DOM structure in the session as each user request comes in.  When the user has completed the workflow, I would serialize the DOM instance out into a database for storage.
>
>Thoughts?  Suggestions?
>  
>

That's exactly the purpose of my current project: edit complex XML 
documents stored in BLOBs, and provide an advanced GUI that totally 
hides the fact that it's an XML file.

The document is loaded in a flowscript global variable (i.e. tied to the 
session), and lots of woody forms modify their respective parts of this 
document. When finished, the user clicks a save button and the document 
is stored in database.

Sylvain

-- 
Sylvain Wallez                                  Anyware Technologies
http://www.apache.org/~sylvain           http://www.anyware-tech.com
{ XML, Java, Cocoon, OpenSource }*{ Training, Consulting, Projects }
Orixo, the opensource XML business alliance  -  http://www.orixo.com