Home arrow XML arrow Page 9 - Java and XML Basics, Part 3
XML

Java and XML Basics, Part 3


So far, during this series of articles (part 1, part 2) we've looked at DOM and SAX, and I suppose most of you are thinking which one of the two approaches is preferable? Well, there is no general rule of thumb, but this article might help you make the right decision when you’ll have to.

Author Info:
By: Liviu Tudor
Rating: 5 stars5 stars5 stars5 stars5 stars / 25
April 20, 2004
TABLE OF CONTENTS:
  1. · Java and XML Basics, Part 3
  2. · Which One is the Better One to Use?
  3. · Running the Parser
  4. · Problems with Big XML Files
  5. · Validating Parsers - DOM
  6. · Where do We Get a Validating Parser?
  7. · ErrorHandler
  8. · Validating Parsers - SAX
  9. · Conclusion

print this article
SEARCH DEVARTICLES

Java and XML Basics, Part 3 - Conclusion
(Page 9 of 9 )

So far, we had a look into validating parsers, but we've only used an XML file that contains the DTD definition embedded inside -- in the next article we will be looking on how to parse XML documents that contain references to external DTDs and how to locate these DTDs.

Appendix: Time measurements for DOM parsing in case of large files:

(see attached file DOM+SAXParsing.txt as well)

File Size

Dom Parsing

SAX Parsing

(MB)

Time (msec)Memory (Mb)Time (msec)Memory (bytes)

2

2484

14

561

1496

5

4325740 (1hr 12min

34

1031 (1 sec)

1784

10

18667154 (5hr 11min)

69

1873 (1.9 sec)

30424

20

72716759 (20hr 12min

138

3535 (3.5 sec)

30424

50

Over 1 day!

329

8542 (8.5 sec)

30424

100

Over 1 day!

 

16443 (16 sec)

30424

NOTE  The figures for the memory in the case of DOM are rounded to the nearest integer number of megabytes.


DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

blog comments powered by Disqus
XML ARTICLES

- Open XML Finally Supported by MS Office
- XML Features Added to Two Systems
- Using Regions with XSL Formatting Objects
- Using XSL Formatting Objects
- More Schematron Features
- Schematron Patterns and Validation
- Using Schematron
- Datatypes and More in RELAX NG
- Providing Options in RELAX NG
- An Introduction to RELAX NG
- Path, Predicates, and XQuery
- Using Predicates with XQuery
- Navigating Input Documents Using Paths
- XML Basics
- Introduction to XPath

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials