• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Performance for incremental transformations with XSL

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I'm working with Tomcat 4.0, Java and Xalan 2.4.
In my code I have the following situation: a class CALLING that instances an object MAKE_CH passing him as parameter an
object org.xml.sax.ContentHandler.
This object is a javax.xml.transform.sax.TransformerHandler and I retrieve him from a static method that create him
in this way:
<!-- Begin Code -->
TransformerFactory tFactory = TransformerFactory.newInstance();
SAXTransformerFactory saxTFactory = (SAXTransformerFactory) tFactory;
TemplatesHandler templatesHandler = saxTFactory.newTemplatesHandler();
// Create an XMLReader and set its ContentHandler.
org.xml.sax.XMLReader reader = org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
reader.setContentHandler(templatesHandler);
reader.parse("C:\\xsl1.xsl");
Templates templates1 = templatesHandler.getTemplates();
reader.parse("C:\\xsl2.xsl");
Templates templates2 = templatesHandler.getTemplates();
Serializer serializer = SerializerFactory.getSerializer(OutputProperties.getDefaultMethodProperties("xml"));
serializer.setOutputStream(System.out);
TransformerHandler transformerHandler1 = saxTFactory.newTransformerHandler(templates1);
TransformerHandler transformerHandler2 = saxTFactory.newTransformerHandler(templates2);
transformerHandler1.setResult(new SAXResult(transformerHandler2));
javax.xml.transform.Result result = new SAXResult(serializer.asContentHandler());
transformerHandler2.setResult(result);
return transformerHandler1;
<!-- End Code -->
Then my class CALLING call a method make_ch_obj.write() where make_ch_obj is the object MAKE_CH created.
This method executes opportunly some query and fill the ContentHandler passed as parameter with the methods
ContentHandler.startDocument(), ContentHandler.startElement, ContentHandler.endElement, ContentHandler.endDocument()
When I call endDocument() it start the incremental transformation, and it's here that my performance fearfully decline!!!
The depth of tree created with write() method (and then with COntentHandler.startDocument(),
ContentHandler.startElement etc.) depends from type of query, and depends from number of data.
With few data I don't have problems, but the growth of data gives me a decline of performance not linear,
but exponential.
I separately checked my two XSL and their functionality is ok. I have also 1 GB of RAM, CPU at 2.40 GHz,
in short I don't think the problem is the Hardware.
Do you have some suggestion for me for improving my performances?
Thank's in advance,
Massimo
 
The knights of nee want a shrubbery. And a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic