Ask a Question

What are the JDO exceptions explain briefly? Explain briefly Message driven Beans. Differentiate between JAXP and JAXB

on 2010-06-01 17:55:49   by Arijit   on Computer Science & Engineering  2 answers

Indraneel

on 2010-06-28 09:30:00  

A message-driven bean is an enterprise bean that allows J2EE applications to process messages asynchronously. It acts as a JMS message listener, which is similar to an event listener except that it receives messages instead of events. The messages may be sent by any J2EE component--an application client, another enterprise bean, or a Web component--or by a JMS application or system that does not use J2EE technology. Message-driven beans currently process only JMS messages, but in the future they may be used to process other kinds of messages.

Indraneel

on 2010-06-28 09:30:00  

Whether one chooses JAXP (Java API for XML) or JAXB (Java API for XML Binding) depends on the requirements of the application. If one needs only a part of data then one should use the SAX parser because ut parses data based on events and is really fast. On the other hand is the document is not too large and nodes have to be inserted or removed then one should go for a DOM parser which allows the manupulation of the in memory xml file by allowing additions and deletion of nodes from this tree. If the requirement is to transform the XML document from one format to another then the best choice is JAXP because it has a built in XSLT tranformer that allows one to transform XML documents, SAX events and even a DOM tree. If the document is is too large for DOM to handle and also one needs an object reprentation of the XML data then you should use the JAXB API. However classes in JAXB do not allow tree manipulation capability and thus they occupy lesser memory footprint. Another important advantage of JAXB over JAXP is that JAXB makes it mandatory for an XML document to have a DTD which is not necessary in case of JAXP. This ensures that the XML documents that are being parsed are valid documents. JAXB also allows one to specify how the code is generated from the DTD including the data types that an element binding will accept and return. However JAX does not have any capability to transform an XML document into different formats which is available in the JAXP API\'s