xsl-list
[Top] [All Lists]

RE: How to speed up parsing ??

2003-08-01 09:13:09
OK, it seems like you are using Java right?
(java -ms25M -mx100M xslFileName xmlFileName > directingOutput.txt)

You can parse the document and create a Document object 
  
  DOMParser parser = new DOMParser();
  parser.parse("D:/foo.xml");
  /* You can parse a File or an InputSource, if you have InputStream then just 
do InputSource s = new InputSource(InputStream) thing. */
  Document document = parser.getDocument();

This Document object is parsed XML. You should store this in memory 
(Session/whatever else)if you repeatedly need it!

Also if you repeatedly need the same XSL file you should use some caching 
mechanism. 
Also, XSL files after parsing can be represented by Templates objects

TransformerFactory tFactory = TransformerFactory.newInstance();
Templates t = tFactory.newTemplates(xslSource);
Transformer transformer = t.newTransformer();

these Templates object can be stored in a HashTable in session or something and 
retrieved when this particular XSL is called again.
This will reduce time. If you need more info, please mail me directly at 
tengshe(_dot_)ashish(_at_)principal(_dot_)com

Lastly, try Translets, I've had better results working with large documents 
(Refer to Mukul Gandhi's post XSLTC)
Thanks,
Ashish



 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list



<Prev in Thread] Current Thread [Next in Thread>