Programming Tutorials Browser Tutorials Articles Struts Tutorials Hibernate Tutorials

  Tutorial: XML Parsing in a Producer-Consumer Model

XML plays a vital role in integrating business-to-business applications. To parse XML files, these applications use either a Simple API for XML (SAX) or a Document Object Model (DOM) parser. Parsing in single-threaded applications is straightforward.

Tutorial Details:

the applications often create a dedicated thread to parse XML, serving many concurrently running threads with the parsed data. This describes one implementation of parsing XML in concurrent applications.
Design Approach
Based on producer-consumer concurrent programming concepts, a dedicated thread acts as producer to parse the XML. A group of threads act as consumers. As the producer thread parses XML data, it stores the data in a shared data structure for the consumer threads to pick up for further processing. To maximize throughput and minimize memory usage, this design uses a special queue for the producer and the consumers to store and to retrieve parsed data, respectively.
XML Parsing
This design uses the SAX API for parsing XML file for the following reasons:

The API reads XML data quickly and efficiently.
It does not construct any internal data representation of XML. Instead, it simply delivers data to the application as it encounters XML elements.
The SAX API fits very well with the producer-consumer model


 

Read Tutorial at: Click here to view the tutorial

Rate Tutorial:
XML Parsing in a Producer-Consumer Model

View Tutorial:
XML Parsing in a Producer-Consumer Model

Related Tutorials:

XML JavaBeans, Part 2 - JavaWorld March 1999
XML JavaBeans, Part 2 - JavaWorld March 1999
 
Java makes the most of XML's extensibility - JavaWorld July 1999
Java makes the most of XML's extensibility - JavaWorld July 1999
 
Programming XML in Java, Part 1 - JavaWorld March 2000
Programming XML in Java, Part 1 - JavaWorld March 2000
 
XML document processing in Java using XPath and XSLT - JavaWorld September 2000
XML document processing in Java using XPath and XSLT - JavaWorld September 2000
 
Alternative deployment methods, Part 3: The code - JavaWorld September 2000
Alternative deployment methods, Part 3: The code - JavaWorld September 2000
 
Mapping XML to Java, Part 1 - JavaWorld August 2000
Mapping XML to Java, Part 1 - JavaWorld August 2000
 
Mapping XML to Java, Part 2 - JavaWorld October 2000
Mapping XML to Java, Part 2 - JavaWorld October 2000
 
Secure thread collaboration across protection domains - JavaWorld December 2000
Secure thread collaboration across protection domains - JavaWorld December 2000
 
XML APIs for databases - JavaWorld January 2000
XML APIs for databases - JavaWorld January 2000
 
Use XML data binding to do your laundry
Use XML data binding to do your laundry
 
Take the sting out of SAX
Take the sting out of SAX
 
XML glossary
XML glossary
 
Sun boosts
Sun boosts enterprise Java
 
FastParser 1.6.3
FastParser 1.6.9.1 XML Edition FastParser is a Java Xml parser High performance XML parser (benchmarks* : up to +100% faster compared to Xerces and JDK1.4 integrated parser) SAX Level 1 and 2 compliant DOM support JAXP compatibility Names
 
JXMLPad 2.3
JXMLPad 2.3 JXMLPad is a pure Swing java component/framework for editing XML/XHTML document.
 
Parsing and Processing Large XML Documents with Digester Rules
Parsing and Processing Large XML Documents with Digester Rules XML is commonly used for integration with third-party applications or web services, especially those that are running on non-Java platforms. On the other hand, if the code is running in a man
 
iCal4j
iCal4j Overview iCal4j is a Java library used to read and write iCalendar data streams as defined in RFC2445. Providing both a parser and an object model, iCal4j allows you to either modify existing iCalendar data or create new data models. Validation
 
XML Messaging Using JBoss
It\'s common practice to share data using FTP, but an increasingly popular alternative is to use a messaging service. As always, each approach has its own pros and cons, depending on the nature of "what to share," how easy it is to implement the technolog
 
JXMLPad 3.1 FC
JXMLPad is a pure Swing java component/framework for editing XML/XHTML document.
 
Parsing an XML Document with XPath
The getter methods in the org.w3c.dom package API are commonly used to parse an XML document. But J2SE 5.0 also provides the javax.xml.xpath package to parse an XML document with the XML Path Language (XPath) .
 
Site navigation
 

 

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2006. All rights reserved.