cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Schmitz, Jeffrey A" <>
Subject RE: Custom Transformer
Date Thu, 01 Mar 2007 14:37:29 GMT
OK (you asked for it), basically I have some xml that needs to be massaged first by a simple
xslt before being fed into my transformer, and then once my transformer is done, I need to
result to be massaged again with another xslt.

My transformer relies on some predefined and specific transformer libraries that I have no
control over, so the xml has to be massaged to fit into the format required by these libraries.
 If I can just build a string with the incoming xml (from the first xslt), I can then feed
this string of xml into the custom transform libraries (as long as the xml contained in the
string is structured correctly). So basically, here is what I need my custom tranformer to

1. Accept SAX events and build a string of the incoming xml
2. Perform transform on the received xml string
3. Output the resulting xml in the form of more Sax events for the next tranformer/serializer
in line.  i.e. something like this:

      String message = doMyCustomTransform(incomingXMLString);
      //Create a reader for turning a string into an InputSource
      XMLReader xmlreader = XMLReaderFactory.createXMLReader();

      //Set the content handler into the XMLReader class.

      //Now feed the source into the xml reader, which will turn around and
      //invoke the proper handlers in the contentHandler based on the
      InputSource source = new InputSource(new StringReader(message));

I've pretty much got steps 2 and 3 worked out.  I just need the step 1 part.

Need anymore details?


-----Original Message-----
From: Grzegorz Kossakowski [] 
Sent: Thursday, March 01, 2007 8:29 AM
Subject: Re: Custom Transformer

Schmitz, Jeffrey A napisaƂ(a):
>  Is there a simple implementation of a Custom Transformer using 
> AbstractSAXTransformer anywhere?  Would love to see just a Hello World 
> program, but can't seem to find one.
The most simple transformer I can think of is StripNamespacesTransformer[1].

It would be much better if you could come up with some details of your own transformer you
want to write so we could give you some clues.


Grzegorz Kossakowski

To unsubscribe, e-mail:
For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message