Hi Paul
Unfortunately there's no way of knowing the number of elements in an XML
document before parsing, nor is there any hook in SAX to know how far you
are inside the stream.
However before you start parsing the XML if you can get the size of the XML
file by
(i) reading the XML from a file and using File.length()
(ii) reading the whole buffer into memory first
Then you could implement your own Reader implementation that kept a count of
the progress its made reading the file (i.e. counts how many bytes are
read) - then as the SAXReader / SAX parser pulls text from the Reader during
the parse, you could fire some event to show some progress indicator or
something.
It might be worth deriving from, say, BufferedReader and to fire an event
whenever the buffer is fetched from the underlying Reader.
James
----- Original Message -----
From: "Paul Gifford" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, September 11, 2001 3:55 AM
Subject: [dom4j-user] Showing progress
> Hello,
>
> I'm parsing rather large documents (multiple megabytes) and would like
to
> display the progress of the parsing to the user, perhaps as a percentage.
> Not knowing the number of elements in a document beforehand, is there a
way
> to get at this information?
>
> Thanks!
>
> Paul
>
>
>
>
> _______________________________________________
> dom4j-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/dom4j-user
>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
dom4j-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/dom4j-user