xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chr-r...@gmx.de (Christian Roth)
Subject [QUESTION] Xalan/Xerces: Progress metering during (stylesheet-) processing
Date Tue, 23 May 2000 13:18:51 GMT

I'm using Xalan for XSL processing in a Swing based environment. My need
is now for a progress indicator. Can anyone recommend a way on how to do

The current code looks like:

// --> Start code: Call XSL Processor
XMLParserLiaison liaison = new XercesLiaison();
XSLTProcessor processor = XSLTProcessorFactory.getProcessor( liaison );
XSLTInputSource xmlIn = new XSLTInputSource( theDoc );
XSLTInputSource xslIn = new XSLTInputSource( theXSLFile );
XSLTResultTarget result = new XSLTResultTarget( outputStream );
processor.setStylesheetParam( "dtd-filename", new XString( "'my.dtd'" )
processor.process( xmlIn, xslIn, result);
// <-- End   code: Call XSL Processor

What I tried so far:

Count nodes in source tree (theDoc) for reference and install a handler
for startElement() event, incrementing current node counter by one on
each call. However, it seems that after installing a corresponding
DocumentHandler via setFormatterListener() or setDocumentHandler() on
the XSLTProcessor interface, its startElement() method would never get
called. Is this because the source is a DOM tree rather than a SAX
parser output?

Also, I'd need progress indication during subsequent validation of the
XSLT-generated XML output through Xerces, which then is a file. There is
the Locator object, which however only returns line/column info, but not
the bytes offset from the beginning of the file (which also cannot be
determined from the line/col information provided). Of course, I do not
know beforehand how many elements resp. nodes there are in the read
file. Any idea on how to determine current processing position without
pre-reading the source file?

Thank you for any ideas or pointers,


View raw message