Project

Profile

Help

Progress Reporting

Added by Anonymous about 15 years ago

Legacy ID: #6539599 Legacy Poster: popchris (iffy456)

Hi, I'm using Saxon 9.1 within a Java application. We're performing XSLT on large XML files and we'd like to set up some kind of progress reporting, to tell us, roughly, what percentage through a document we are. Is this currently possible? Thanks Chris.


Replies (1)

RE: Progress Reporting - Added by Anonymous about 15 years ago

Legacy ID: #6539760 Legacy Poster: Michael Kay (mhkay)

Unless you're using streaming, the processing is essentially in two phases: the first phase is XML parsing and tree building, the second is transformation and serialization. You could monitor the progress of the first phase by setting up a SAX filter to monitor the parsing events as they pass from the XML parser to the Saxon tree-builder. That's easy enough to do using JAXP interfaces if you run the transformation as a TransformerHandler. Very often for a simple transformation this phase will dominate. The second phase is trickier because it's less linear. You can monitor it for example using the TraceListener interface, but unless you know a lot about the behaviour of your transformation, there's no obvious way to predict when it will finish. Of course if it is linear, like transforming 100000 similar transactions in a flat transaction file, then you may be able to identify the events associated with each transaction being processed. Then you still have the problem of knowing how many of them there are in the file. But if you are processing large files then perhaps you are using streaming? In that cases the two phases above effectively run in parallel, and a Sax filter catching the parser events should be enough to monitor the whole process. You could insert this into the pipeline using a URIResolver that responds to the streaming doc() call.

    (1-1/1)

    Please register to reply