Marcus,

I've never worked with cocoon commandline.  But from your message, I guess
that you want to produce a DOM tree explicitly.  If so, then you don't need
to worry about the HttpServletRequest.  As I understand (I'm also new with
cocoon 1.), the way cocoon 1 works is that the Request obj will get client
request and decide which producer to call.  That's why HttpServletRequest is
there.  If you pass to your webtool two arguments as you described, you can
just use the first one to create an input stream for the parser which will
return a DOM tree.  What I don't understand is how you can make the Reactor
and the Formatter get involved.


>-----Original Message-----
>From: Markus Wagner [mailto:[EMAIL PROTECTED]]
>Sent: Wednesday, June 27, 2001 9:49 PM
>To: [EMAIL PROTECTED]
>Subject: Re: translate file.xml?args into html using java
>
>
>Hi Minh-Quan,
>
>thank you very much!
>
>I made a standalone commandline tool which uses the cocoon library. It 
>takes an xml file and a parameter string as arguments. It 
>should produce a 
>html file, the same as would be produced by the url 
>"myfile.xml?arg=val". 
>I think a standalone tool with its own commandline entry point 
>is needed, 
>because the cocoon commandline entry does not take arguments ('error: 
>myfile.xml?arg=val not found').
>
>So I call my tool:
>
>$ webtool myfile.xml page=4
>
>My tool would create myProducer, which should then do the task, as you 
>wrote. So I give it a method like this:
>
>Document getMyDocument (String xml,String args);
>
>Let's look at the method in ProducerFromFile:
>
>public Document getDocument(HttpServletRequest request) throws 
>Exception
>{
> String file = Utils.getBasename(request, this.context);
> this.monitor.watch(Utils.encode(request), new File(file));
> return parser.parse(new InputSource(file));
>}
>
>As you said I have to do it in a similar way, but involve the 
>arguments 
>somehow. I guess in the ProducerFromFile the arguments are 
>stored in the 
>request parameter. So I could simulate a url like "myfile.xml?args" by 
>creating a request object on the fly and do the rest like 
>ProducerFromFile.
>
>So far so good, but two single questions remain:
>
>- How is myProducer involved?
>  There is the static main function of my webtool
>  class. Can I simply create my producer and call
>  the getMyDocument method?
>
>- How to make my HttpServletRequest?
>  I tried something like that before, but since
>  HttpServletRequest is abstract I cannot make
>  it myself.
>
>I would very appreciate if you could give me a second tip.
>
>Thank you,
>
>Markus
>
>
>
>On Wednesday 27 June 2001 20:11, you wrote:
>> >I got cocoon to translate my xml files into html using the 
>commandline
>> >interface to cocoon. But I didn't get it to translate xml 
>files which
>> >expect arguments as file.xml?index=3. Cocoon always 
>produces the same
>> >output as if there were no arguments. I would like to write a
>> >small java
>> >tool that involves the cocoon library to translate a url with
>> >arguments
>> >into a html file. How can I do that and which classes do I 
>have to use
>> >(Cocoon 1.8)?
>>
>> The default cocoon producer is the ProducerFromFile (under
>> cocoon/producer). You can write your own producer which takes in
>> arguments and recompile cocoon.  You can also configure your 
>producer to
>> be a default one.  Look at cocoon.properties.
>>
>> Minh-Quan
>>
>> ---------------------------------------------------------------------
>> Please check that your question has not already been answered in the
>> FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>>
>> To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>> For additional commands, e-mail: <[EMAIL PROTECTED]>
>
>---------------------------------------------------------------------
>Please check that your question has not already been answered in the
>FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>
>
>To unsubscribe, e-mail: <[EMAIL PROTECTED]>
>For additional commands, e-mail: <[EMAIL PROTECTED]>
>

---------------------------------------------------------------------
Please check that your question has not already been answered in the
FAQ before posting. <http://xml.apache.org/cocoon/faqs.html>

To unsubscribe, e-mail: <[EMAIL PROTECTED]>
For additional commands, e-mail: <[EMAIL PROTECTED]>

Reply via email to