Sounds like I'm at least in the ballpark, I'll take a look at setConsumer.

Thanks for your help, would have taken me a LONG time looking all this up.

Jeff 

-----Original Message-----
From: Grzegorz Kossakowski [mailto:[EMAIL PROTECTED] 
Sent: Thursday, March 01, 2007 10:36 AM
To: users@cocoon.apache.org
Subject: Re: Custom Transformer

Schmitz, Jeffrey A napisaƂ(a):
> Thanks!
>
> So something like this (did I get the SaxBuffer stuff right?):
>
> public class Mytrans extends AbstractTransformer implements
>               CacheableProcessingComponent {
>
>     XMLConsumer tempConsumer;
>     SaxBuffer mySaxConsumer = new SaxBuffer();
>     String content;
>
>     public void setup(SourceResolver resolver, Map objectModel, String src,
>                       Parameters params) throws ProcessingException, 
> SAXException,
>                       IOException {
>
>       tempConsumer = xmlConsumer;
>       xmlConsumer = mySaxConsumer;
>
>    }
>
>
>       public void endDocument() throws SAXException {
>               
>               super.endDocument();
>               content = mySaxConsumer.toString();
>               xmlConsumer = tempConsumer;
>               
>               content = myTransform(content);
>               
>               StringXMLizable xmlStr = new StringXMLizable(content);
>
>               xmlStr.toSAX(contentHandler);
>                 
>       }
>
>  }
>   
I've never used SaxBuffer so I can't tell you if you use it correctly but I 
believe so. You should set your own consumer calling setConsumer method (take 
look on it to see why).
The rest seems to look ok. The best way is to try it and eventually debug.

--
Grzegorz Kossakowski

---------------------------------------------------------------------
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]

Reply via email to