Skip to content

JAXP

August 5, 2009
tags:

The Java API for XML Processing (JAXP) enables applications to parse, transform, validate and query XML documents using an API that is independent of a particular XML processor implementation. JAXP provides a pluggability layer to enable vendors to provide their own implementations without introducing dependencies in application code.  Using this JAXP, application and tool developers can build fully-functional XML-enabled Java applications for e-commerce, application integration, and web publishing.

The Simple API for XML (SAX) is available with the Java API for XML Processing (JAXP).SAX is one of two common ways to write software that accesses XML data.

Using SAX with JAXP allows developers to traverse through XML data sequentially, one element at a time, using a delegation event model. Each time elements of the XML structure are encountered, an event is triggered. Developers write event handlers to define custom processing for events they deem important.

Because all the XML data processed does not need to be kept in runtime memory, SAX is very useful for processing very large XML documents or streams. However, if there is a need to randomly access or modify the XML data, DOM should be used.

The Document Object Model (DOM) is available as part of the Java API for XML Processing (JAXP). DOM is one of two common ways to write software that accesses XML data.

Using DOM with JAXP, developers can create a representation of an XML document in runtime memory either by parsing the data from an existing XML source or constructing the document using the DOM API. Once the document exists in memory, it is possible to access or modify any element in random order.

For very large sets of XML data, using DOM may not be practical because it may demand too much runtime memory. In such cases developers should use SAX, which gives more constrained access to the XML data but is more efficient.

Advertisements
One Comment leave one →
  1. jimmyzhang permalink
    December 2, 2009 2:08 am

    you may also want to check out vtd-xml, the latest and most advanced xml processing model

    vtd-xml

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: