RE: Question on generators...

2003-03-03 Thread SriKumar Kareti
Geoff,

Thanks. Got it working with minimal effort.

Kumar.

-Original Message-
From: Geoff Howard [mailto:[EMAIL PROTECTED]
Sent: Friday, January 31, 2003 9:48 PM
To: [EMAIL PROTECTED]
Subject: RE: Question on generators...


Then yes, you can reuse it - but you should be aware that it's not very
optimized doing xml generation through string.  If you're doing short
documents, you may not notice any issue.  But if you have a larger
document
you may wish to reimplement in SAX.  Try it first as is - you may be
perfectly satisfied.

The short answer about how is basically:
1) Make sure you read up on Generators, including the tutorial on
CustomGenerators if you haven't already.  Also read up on Avalon (the
stuff
at in the Cocoon docs should be enough).
2) Create a generator that imports your original class, and populate a
String in your Generator by calling appropriate methods in your class.
Exactly how is 100% determined by the specifics of how it works now, but
I
trust you can figure that part out.

I have to gloss over the next details I think until I know what version
you're using:
3) Lookup the parser from Cocoon's ComponentManager (which means your
Generator needs to extend ComposerGenerator, or implement Composable
itself).
4) Do InputSource inputSource = new InputSource(new StringReader(
yourXMLString ));
5) Pass that inputSource to parse();

What version of Cocoon are you using? 2.0.3, 2.0.4, or 2.1dev?

If you're using 2.1dev, check out WebServiceProxyGenerator (quick before
someone refactors it to not use String anymore).  It does almost exactly
what you want, except it gets the String over HTTP from any arbitrary
url.
In fact, you may look into that as a quick option.  Don't know your
current
setup, but if you can call the servlet and get xml string back via HTTP
you
could be finished quite quickly.

HTH,
Geoff Howard

 -Original Message-
 From: SriKumar Kareti [mailto:[EMAIL PROTECTED]
 Sent: Friday, January 31, 2003 2:08 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Question on generators...



 Geoff,

 I was creating String...

 thx...

 -Original Message-
 From: Geoff Howard [mailto:[EMAIL PROTECTED]
 Sent: Friday, January 31, 2003 12:28 PM
 To: [EMAIL PROTECTED]
 Subject: RE: Question on generators...


 This all depends on what you were doing in your class.  Were you
 creating
 xml?  If so, DOM, SAX or String?

 Geoff

  -Original Message-
  From: SriKumar Kareti [mailto:[EMAIL PROTECTED]
  Sent: Friday, January 31, 2003 10:21 AM
  To: [EMAIL PROTECTED]
  Subject: Question on generators...
 
 
 
  Thanks for you help in advance...
 
  I am a new user to Cocoon. I have searched the site pretty well and
  could
  not answer this question. Could someone help...
 
  My goal is to move from current servlet based solution to Cocoon.
The
  general
  flow of my current program is
 
  1) Take the request,
  2) Generate the XML by making calls to Database based on the
 parameters
 passed...
  3) Use XSLT to generate html which is returned...
 
  Now I'd like to move to cocoon. I want to use my existing Java class
  as the generator in Cocoon.
 
  Can I do that?
 
  SriKumar.
 
 
-
  Please check that your question  has not already been answered in
the
  FAQ before posting.
http://xml.apache.org/cocoon/faq/index.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/faq/index.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/faq/index.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/faq/index.html

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


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



Question on generators...

2003-01-31 Thread SriKumar Kareti

Thanks for you help in advance...

I am a new user to Cocoon. I have searched the site pretty well and
could
not answer this question. Could someone help...

My goal is to move from current servlet based solution to Cocoon. The
general
flow of my current program is 

1) Take the request, 
2) Generate the XML by making calls to Database based on the parameters 
   passed...
3) Use XSLT to generate html which is returned...

Now I'd like to move to cocoon. I want to use my existing Java class
as the generator in Cocoon.

Can I do that?

SriKumar.

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

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




RE: Question on generators...

2003-01-31 Thread SriKumar Kareti

Thank you Lionel, I will try it out.

-Original Message-
From: Lionel Crine [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 9:42 AM
To: [EMAIL PROTECTED]
Subject: Re: Question on generators...


Yes you can do a generator :

Here is what I did, this is a main structure :



import your_package;


public class your_class extends ComposerGenerator (or
absctractGenerator)
{
...

 public void setup(SourceResolver resolver, Map objectModel, String 
src, Parameters par)
 throws ProcessingException, SAXException, IOException
 {
 super.setup(resolver, objectModel, src, par);
}

 public void recycle()
 {
}

 public void generate() throws SAXException, IOException, 
ProcessingException
 {
/*  to generate sax events  */
}

for exemple:
 public void your_method throws IOException, SAXException, 
ProcessingException
 {
}


-
Please check that your question  has not already been answered in the
FAQ before posting. http://xml.apache.org/cocoon/faq/index.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/faq/index.html

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




RE: Question on generators...

2003-01-31 Thread SriKumar Kareti

Geoff,

I was creating String...

thx...

-Original Message-
From: Geoff Howard [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 31, 2003 12:28 PM
To: [EMAIL PROTECTED]
Subject: RE: Question on generators...


This all depends on what you were doing in your class.  Were you
creating
xml?  If so, DOM, SAX or String?

Geoff

 -Original Message-
 From: SriKumar Kareti [mailto:[EMAIL PROTECTED]]
 Sent: Friday, January 31, 2003 10:21 AM
 To: [EMAIL PROTECTED]
 Subject: Question on generators...



 Thanks for you help in advance...

 I am a new user to Cocoon. I have searched the site pretty well and
 could
 not answer this question. Could someone help...

 My goal is to move from current servlet based solution to Cocoon. The
 general
 flow of my current program is

 1) Take the request,
 2) Generate the XML by making calls to Database based on the
parameters
passed...
 3) Use XSLT to generate html which is returned...

 Now I'd like to move to cocoon. I want to use my existing Java class
 as the generator in Cocoon.

 Can I do that?

 SriKumar.

 -
 Please check that your question  has not already been answered in the
 FAQ before posting. http://xml.apache.org/cocoon/faq/index.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/faq/index.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/faq/index.html

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