cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ian Atkin <I...@Widelearning.com>
Subject RE: the output stream
Date Wed, 08 Nov 2000 15:55:53 GMT
robin,

sorry about the explanation, i hope this is clearer:-

i have written a servlet-based wrapper around the Schematron validator.

this validator is a multi-step tranform that produces a list of errors:-
- the rules are in an XML file
- the transform produces an XSLT script which can be used to produce the
error list when given a target instance to operate on

lists of errors on their own are pretty useless, they need to be linked to
the offending elements (esp if non-technical people will be using them).

so at the same time as making the error list I also make a pretty-printed
source view of the target xml (the two display in a frame each)

by using the generate-id() function I can get a unique id for every node in
the target xml, which allows me to put named anchors in the source view and
reference them from the error list
- meaning that the user can click on an error and the source view moves to
the offending element (it also greys the background as well :-)

the generate-id() function will only return the same id if the node tree
doesn't change.

I am researching the viability of cocoon for an intranet framework, and want
to see what it is like building web apps for it.
- therefore I decided to port the above from a servlet to cocoon

at first I was trying to use the Xalan processor in cocoon to do the
transformations as it's already instantiated and so on.

due to where my files are stored, and the fact that they were not written
for cocoon in mind (ie no PIs) and there are so many that I can't add the
PIs, I must modify the XML on the fly
- read into a buffer, insert the PIs, transform from that buffer

this breaks the generate-id() function because the XML has changed between
the transforming of the error list and the transofrming of the source view

as a result I simply implemented the servlet implementation as an XSP page

this works fine from a users ppint of view, both transforms happen and the
linking works but...

tomcat is throwing an IllegalStateException

all i'm asking is for advice, would people on this list:-
- ditch the idea of doing this within cocoon, just use the servlet impl
- wait until cocoon 2 comes along and the PIs are no longer needed (thus the
node tree doesn't change and the generate-id() function would work)
- any other ideas

all I can think of is something like:-
- the response stream could be 'owned' and that ownership be temporarily
handed over to external components for them to do their own output , after
which the component would return ownership back to cocoon

i've no idea whether this is a Good Thing, a Bad Thing, or Just Plain
Madness, this is just an exploratory question nothing more.

incidently i think that the fact that XSP pages do not have control over the
output stream as a Good Thing, I can see the reasoning behind it and it is
starting to grow on me.

the issue really is whether cocoon can be used with components that want
direct output (even if they should return XML to cocoon for later
processing)

bleeding-edge architectures like cocoon shouldn't be held back by current
implementations, but they will recieve far greater adoption if they can work
with them


apologies for the length of mail, but you did ask for accuracy :-)

Ian Atkin
Code Monkey & Text File Editor
Wide Learning
ian.atkin@widelearning.com
020-7253-1211

> -----Original Message-----
> From:	Robin Green [SMTP:greenrd@hotmail.com]
> Sent:	08 November, 2000 2:11 PM
> To:	cocoon-users@xml.apache.org
> Subject:	Re: the output stream
> 
> Ian Atkin <Iana@Widelearning.com> wrote:
> >people,
> >
> >i've got a nasty problem with the design of cocoon that i need help with,
> 
> >it
> >goes something like this:-
> >
> >i am doing two independent transforms simultaneously on the same XML
> input
> >- they create different kinds of output
> >
> >one output references the other, using named achors
> >
> >i'm using the generate-id() function to give me the id's necessary to
> name
> >the anchors on one output and call the anchors on the other output
> >
> >i implemented this using servlets and xt and am converting to cocoon.
> >
> >initially I tried to use the xerces/xalan combo in cocoon, but because of
> >the use of PIs I had to modify the XML input to insert them - which threw
> >out the generate-id() function so my linking between outputs didn't work
> >anymore
> >
> >as a result I have simply converted my servlet to an XSP page
> 
> good!
> 
> >
> >the problem now is that my XSP page indirectly writes to the output
> stream
> >(i pass the response object to XT, which does the writing)
> 
> Why?? I don't understand why you need to do this. One solution that 
> immediately springs to mind is "servlet chaining" (see FAQ) but it might
> be 
> helpful if you could explain more specifically what you're trying to do.
> Why 
> do you need to do two transforms? Can't you merge them into one?
> 
> >
> >naturally I'm now getting the following exception from tomcat:-
> >
> >IllegalStateException: Output stream is already being used for this
> request
> >
> >the application still works fine, presumably because the XSP page is
> doing
> >no writing of it's own
> >
> >while I quite except that not being able to write to the output stream is
> 
> >an
> >XSP feature, I *really* need to find a solution to this.
> 
> Solution to what? I thought you said the application works fine???
> 
> 
> 
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
> 
> Share information about yourself, create your own public profile at 
> http://profiles.msn.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message