Sunday, 13 December 2015

Basics of JAXP


So far we have seen the basics of parsers like SAX and DOM. Now another most terrifying term in XML is JAXP. Need not to worry because you have already seen some part of it. Surprising!! How? Let’s dig in to the basics of JAXP then.

JAXP, it stands for Java API for XML Processing. The on-going API version for JAXP is 1.6.

Now, one of the most interesting query about JAXP is what sort of API actually it provides. I mean what is this all about.

Simply if we say, it is an interface or a kind of plug-in provided or a layer provided to plug in various implementations whether it is own or a third party vendor implementation for XML processing. So what kind of XML processing it will do, The Plug-in API provides you platform for processing an XML in terms of Parsing, Presentation, and Streaming etc.

Well! Again term comes here, Right!! Parsing. We have already seen SAX and DOM parser in previous blogs. What we are going to discuss here about parsing is the basics architecture and little more examples with in-depth explanation for SAX and DOM API provided inside JAXP API. Other than that we will also see the basics of some other XML processing task and How JAXP will help to achieve them.

There are various packages define with in JAXP API for these different tasks are:-

  • javax.xml.parser: This package provides a common interface for SAX and DOM parsing activities.
  • org.w3c.dom: This package having components that defines XML as a Document class and also some more component classes are available for other elements of XML file like Attributes, Node etc.
  • org.xml.sax: This package provides basic API for SAX.
  • javax.xml.transform: This package contains API for transforming XML in to various other forms in terms of presentation. These transformations API are called XSLT API. We will see later what this is exactly.
  • javax.xml.stream: This is the very latest API included in JAXP from version JAXP 1.4 i.e streaming API for XML also in short term it is called as stAX. Remember ‘st’ is in small letter and ‘AX’ in caps letter. We will later discuss about this as well.

We have discuss some part of parsing stuff with SAX and DOM in my previous post. Where we have seen the Basics of XML as well and also how to parse them using SAX and DOM parser. Now we will see more basics about its architecture and some more examples in terms of JAXP API. We will see all the above JAXP packages provided API in detail in our next blog sections on:

SAX API  
DOM API
XSLT API
stAX API


No comments:

Post a Comment