cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ugo Cei <>
Subject Re: JXForms, flow and XML data store
Date Thu, 10 Jul 2003 12:38:35 GMT
Upayavira wrote:
> I'd like to start building a site that uses jxforms and flow to allow the user to edit

> content (addresses) stored in a single XML file. There'll be one user responsible 
> for up to 200 addresses, with the addresses visible on a public site.
> The addresses are all stored in a single XML file.
> I can see how, using jxforms/flow, I can really easily build the front end. But how 
> do I get my data out of my XML file, and then get the changed data back into it? 
> I could do it in Java, but that'd require XML parsers, serializers, etc, etc, which'd

> be a pain to write for such a small and simple site.
> Can I use jxpath in some way to access the XML file resource?
> Regards, Upayavira

I'm doing something similar, even though my form's model is the whole 
XML file and not just some part of it (but it should be easy to extract 
just what you need using JXPath). Since a form's model can be a DOM and 
not just a bean, you could just parse the file and set the Document as 
the form's model:

/* WARNING: Exception handling removed for brevity */


function newPaziente(form, pathname) {
   var parser = cocoon.getComponent(DOMParser.ROLE);
   var domPaziente = parser.parseDocument(new InputSource(pathname));
   if (parser != null) {
     parser = null;
   var fos = null;
   fos = new;
   var writer = new DOMWriterImpl();
   writer.writeNode(fos, domPaziente);


Ugo Cei -

View raw message