axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apaella Yahoo! <apae...@yahoo.it>
Subject Why this don't work?
Date Mon, 23 Feb 2004 15:15:33 GMT
Hello *,

I'm looking axis .jws files but I don't understand why this
code-snippet don't work...

If I change
   out.toString();
in
  ((ByteArrayOutputStream).out).size();


it works perfectly :(

Seems to have some problems with fop....

I need only to generate a pdf from a Xml+Xsl-fo urls

some helps??


###################################################################################################################
import java.io.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import javax.xml.transform.sax.*;

//FOP
import org.apache.fop.apps.Driver;
import org.apache.fop.apps.FOPException;
import org.apache.fop.messaging.MessageHandler;

/**
 * This class demonstrates the conversion of an XML file to PDF using 
 * JAXP (XSLT) and FOP (XSL:FO).
 */
public class xslfo {

    public String render(String xml, String xsltURL) throws TransformerConfigurationException,TransformerException

    {
        OutputStream out = new ByteArrayOutputStream();
        org.apache.fop.apps.Driver driver = new Driver();
        driver.setRenderer(Driver.RENDER_PDF);
        driver.setOutputStream(out);
        TransformerFactory factory = TransformerFactory.newInstance();
        Transformer transformer = factory.newTransformer(new
                StreamSource("http://localhost:8080/axis/xml/xslt/projectteam2fo.xsl"));
        Source src = new StreamSource(
               "http://localhost:8080/axis/xml/xml/projectteam.xml");
         Result res = new SAXResult(driver.getContentHandler());

         //Start XSLT transformation and FOP processing
         transformer.transform(src, res);
         return out.toString()+"a";
  }
}

  

-- 
Best regards,
 Apaella                          mailto:apaella@yahoo.it


Mime
View raw message