简体   繁体   中英

How can I monitor XML parsing in Java (with JDOM)?

I'm developing an app that parses big XML files (over 200k lines, about 4-5 MB), and I would like to monitor the parsing using a progress bar. I'm using JDOM v1.1.1 and SaxBuilder.

Anyone knows how to achieve that ?

Thanks

You could, I suppose, subclass org.jdom.DefaultJDOMFactory , and override some of the methods to track when certain nodes get created. You can then pass an object of that subclass to the SAXBuilder.setFactory .

It's be up to you to decide what constitutes "progress", though, which you'll only be able to decide based on the structure of the XML.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM