Hi all,

I've tried to use the class StringXMLizable to insert xml data 
into the sax stream. When I serialize the stream <map:serialize type="xml"/>
without further transformation everything works fine. 
When I tried to transform the output stream with xslt stylesheet 
(<map:transform type="xslt")
in a pipeline I get the error: 

### cut here ###
java.lang.RuntimeException:

Cocoon stacktrace[hide]
Failed to process pipeline 
.....
### cut here ###


Here is the source of my transformer:


### cut here ###

import java.io.IOException;
import java.util.Map;

import org.apache.avalon.framework.logger.LogEnabled;
import org.apache.avalon.framework.logger.Logger;
import org.apache.avalon.framework.parameters.Parameters;
import org.apache.cocoon.ProcessingException;
import org.apache.cocoon.environment.SourceResolver;
import org.apache.cocoon.transformation.AbstractTransformer;
import org.apache.cocoon.xml.StringXMLizable;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

public class Saxxml extends AbstractTransformer implements LogEnabled
{
    // The LogEnabled interface is one method: enableLogging
    private Logger logger;
   
    public void enableLogging(Logger logger)
    {
        this.logger = logger;
    }
   
    public void setup(SourceResolver sourceResolver, Map objectModel,
            String str, Parameters parameters) throws ProcessingException,
            SAXException, IOException
    {
        
            logger.info("setup");
    }

    public void startElement(String namespaceURI, String localName,
            String qName, Attributes attributes) throws SAXException
    {
       
        logger.info("startElement");
        
        if ( localName.equals("extern") )
        {
            super.startElement(namespaceURI, localName, qName, attributes);
            String externalXML =
                "<external>"           + 
                "<ex>  This is StringXMLizable </ex>" +
                "<ex>  this too  </ex>"+
               "<ex2> <![CDATA[</ex2> <html><text> </hr> as cdata ]]></ex2>"+
               "</external>";
              
            StringXMLizable mysax= new StringXMLizable(externalXML);
            // ... and here  we go !!
            try 
            {
                mysax.toSAX(this.contentHandler);
            }
            catch ( SAXException ee)
            {
                logger.error(ee.getMessage() );
            }
        }
        else
            super.startElement(namespaceURI, localName, qName, attributes);
        
        return;
    }

    
    public void endElement(String namespaceURI, String localName, String qName)
            throws SAXException
    {
        logger.info("endElement");
        super.endElement(namespaceURI, localName, qName);
    }   
}

### cut here ###


Here is the important part of the sitemap.xmap
### cut here ###
                        
        <map:match pattern="saxxml.html">
          <map:generate src="test.xml" />
          <map:transform type="t2"/>
          <!-- Here I get the error -->
          <map:transform type="xslt" src="my2t.xsl" />
          <map:serialize type="xml" />
        </map:match>

### cut here ###

Many thanks

Frank 

-- 
Der GMX SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen! 
Ideal für Modem und ISDN: http://www.gmx.net/de/go/smartsurfer

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

Reply via email to