• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Types of XML Parsers

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that there are two types of XML Parsers. Can any one tell me what they are and how they can be used with respect to EJB.
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
While it's true that there are two "types" of XML parsers, there are actually many different APIs, parsers and document models to choose from. You are free to consider and use whichever best suits your application.
The two "types" of parser are:
1. "whole document" parsers. These read in a whole XML document in one go, and provide the software which uses it a way to traverse the XML "tree" to examine the content. The DOM language-independent model is often used by "whole document" parsers, but other models do exist, and there are several APIs for acecssing such a model, even only considering Java.
It's worth noting that just because a parser reads a whole XML document in one go, doesn't mean that it necessarily provides all possible tree-traversal options. For example, I often use an XML micro-parser (less than 10K of Java class files) to read application configurations and present the same interface as if they had come from a standard Java "properties" file.
2. "sequential" parsers. These are typified by the SAX API, but there are many others available. To use a parser of this type, you initialize it, then add "callbacks" for some or all of the possible XML tags and content data.
"sequential" parsers are especially useful if your application only needs to extract specific, information from a potentially large XML document. Unlike "whole document" parsers, a "sequential" parser never has to hold the whole document in memory, just the bits its interested in.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!