cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bruno Dumon <br...@outerthought.org>
Subject Re: Woody Populate Form with xsp (flow)
Date Sat, 08 Nov 2003 17:22:05 GMT
On Fri, 2003-11-07 at 22:37, Upayavira wrote:
> JD Daniels wrote:
> 
> >I was wondering if it was possible to load an xsp pipeline instead of a
> >source xml file..
> >
> >ex.
> >// parse the document to a DOM-tree
> >var document = loadDocument("forms/test.xml");
> >
> >// bind the document data to the form
> >form.load(document);
> >form.showForm("display-pipeline");
> >
> >Change to:
> >
> >// Load DOM-tree From Xsp
> >
> var uri = "context://formdata.xsp?id=" + cocoon.request.get("id");
> 
> var resolver = 
> cocoon.getComponent(Packages.org.apache.excalibur.source.SourceResolver.ROLE);
> var source = resolver.resolve(uri);
> var parser = 
> cocoon.getComponent(Packages.org.apache.excalibur.xml.dom.DOMParser.ROLE);
> var document = 
> parser.parseDocument(Packages.org.apache.cocoon.components.source.SourceUtil.getInputSource(source));
> 
> form.load(document);

A bit more optimized would be:

var document =
Packages.org.apache.cocoon.components.source.SourceUtil.toDOM(source);

this will build the DOM directly from the SAX events comming out of the
XSP, instead of first serializing to XML and then reparsing.

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


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


Mime
View raw message