cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Torsten Curdt" <tcu...@dff.st>
Subject RE: XSPGenerator
Date Tue, 12 Dec 2000 11:50:46 GMT
Yes! This seems to work!! 8-))
But we need the generateContent() method.
This must be changed when generating the java code.

So can we change the XSPGenerator class? Are there any
Problems that I might not see?

That would bring at least full page content aggregation!
--
Torsten


> -----Original Message-----
> From: Torsten Curdt [mailto:tcurdt@dff.st]
> Sent: Tuesday, December 12, 2000 11:22 AM
> To: Cocoon-Dev
> Subject: XSPGenerator (ricardo?)
> 
> 
> I've some questions regarding the XSPGenerator class.
> 
> I'm trying to call a generate methode from another
> XSPGenerator.
> 
> class _index_xml extends XSPGenerator{
>     public void generate() throws SAXException {
>     /* some SAX */
> 
>     /* create an instance of _include_xml */
>     /* later on include.xml should appear in the */
>     /* dependencies */
>     _included_xml g = new _included_xml();
> 
>     /* copy the needed attributes */
>     g.setContentHandler(this.contentHandler);
>     g.setLexicalHandler(this.lexicalHandler);
> 
>     /* direct output from the other XSPGenerator */
>     /* in the same pipeline */
>     g.generate();
> 
>     /* some SAX */
>     }
> }
> 
> class _included_xml extends XSPGenerator{
>     public void generate() throws SAXException {
>     /* some SAX */
>     }
> }
> 
> 1. Do I need to do a full copy of all attributes?
>    (if then - what about implementing cloneable?)
>    Which are required for the generate to work
>    properly?
> 
>    protected javax.servlet.http.HttpServletRequest request
>    protected javax.servlet.http.HttpServletResponse response
>    protected javax.servlet.ServletContext context
>    protected org.apache.avalon.ComponentManager manager
>    protected org.xml.sax.EntityResolver resolver
>    protected java.util.Map objectModel
>    protected org.apache.avalon.Parameters parameters
>    protected java.lang.String source
>    protected org.apache.log.Logger log
>    protected org.xml.sax.ContentHandler contentHandler
>    protected org.xml.sax.ext.LexicalHandler lexicalHandler
> 
> 2. Do I need to initialize anything else when creating
>    a XSPGenerator this way? (Sorry, to bother you I'm
>    still not that into the C2 source code)
> 
> 3. Calling another generate method would give us another
> 
>     this.contentHandler.startDocument();
>     this.contentHandler.startPrefixMapping("xsp", 
"http://apache.org/xsp");
    this.contentHandler.endPrefixMapping("xsp");
    this.contentHandler.endDocument();

   I guess they shouln'd be called since there are
   alreay some in the pipeline, right?

   What about having two methods in XSPGenerator then?

    class _included_xml extends XSPGenerator{
      public void generateContent() throws SAXException {
         /* SAX */
      }

      public void generate() throws SAXException {
         this.contentHandler.startDocument();
         this.contentHandler.startPrefixMapping("xsp",
"http://apache.org/xsp");

         generateContent();

         this.contentHandler.endPrefixMapping("xsp");
         this.contentHandler.endDocument();
      }
    }

If this is done we could extend the xinclude syntax to
e.g. <xinclude:include parse="xml" type="serverpage" href="included.xml"/>
And voila... basic content aggregation
--
Torsten



Mime
View raw message