Announcement

Collapse
No announcement yet.

Performanz bei XSL-Transformation in JavaJDK

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Performanz bei XSL-Transformation in JavaJDK

    I have a performance issue concerning Java and XSLT: my goal is to transform an xml file (source.xml)
    by using a given xsl file (transformation.xsl). As result I would like to get a String object, in which the result
    of the transformation (html-code) is in, so that I can display it in a browser. The problem is the long time
    it takes for the code below to run through.

    xml = new File("C:\\source.xml");
    xmlSource = new StreamSource(xml);

    xslt = new File("C:\\transformation.xsl");
    StreamSource xsltSource = new StreamSource(xslt);

    TransformerFactory transFact = TransformerFactory.newInstance();
    trans = transFact.newTransformer(xsltSource);

    StringWriter stringWriter = new StringWriter();
    StreamResult streamResult = new StreamResult(stringWriter);
    trans.transform(xmlSource, streamResult);

    String output = stringWriter.toString();
    stringWriter.close();

    Before, I made the same transformation in an xml development environment, named Cooktop
    (see http://xmlcooktop.com/). The transformation took about 2 seconds. With the code above in Java it
    takes about 20 seconds.

    Is there a way to make the transformation in Java faster?

    Thanks in advance,

    Marcello
    Oldenburg, Germany
    [email protected]

  • #2
    Try using Cocoon!

    Comment

    Working...
    X