Bekanntheitsgrad – Blog

Nice to have you here …



XMLBeans Or JAXB What To Choose

By Sadi Melbouci


Owner of the site: Mental Health Practice Software

Within the medical field, HIPAA transactions are defined with EDI format, XML is just starting to get in the door.

I would like to address some differences between JAXB and xmlBeans in processing of XML documents.
JAXB is a part of JavaEE standards and provides a convenient way to bind an XML schema to a set of Java classes. This allowsh an easy way to process data in java technology without having to understand all the ins and outs of te XML technology.

JAXB 2.0, available in in the open-source Java EE 5-compliant application server at Glassfish project is part of the new integrated stack for Web services development. This new version of JAXB includes all the data binding functionality in a single package, while the previous Web services development stack (in Java Web Services Developer Pack 1.6 and previous versions) carried out some data binding in the JAX-RPC 1.x package and some in the JAXB 1.x package. With the integrated stack comprising JAX-WS 2.0, JAXB 2.0, and SAAJ 1.3, the Web services description, data binding, and SOAP attachment processing functionality are more logically architected, enabling you to develop Web services, middle tier and Web applications more easily.

XmlBeans was originally developed by BEA Systems, it is now an open source project. xmlBeans provide similar functionality then JAXB but may require some good knowledge of XML technology.
Prior to this technologies, one way to proccess an XML document, perhaps the most typical way, is through parsers Simple API for XML (SAX) or the Document Object Model (DOM). Both of these parsers are provided by

Java API for XML Processing (JAXP). The developer writes code to invoke a SAX or DOM parser through the JAXP API to parse an XML document — that is, scan the document and logically break it up into discrete pieces. The parsed content is then made available to the application. In the SAX approach, the parser starts at the beginning of the document and passes each piece of the document to the application in the sequence it finds it. Nothing is saved in memory. The application can take action on the data as it gets it from the parser, but it can’t do any in-memory manipulation of the data. For example, it can’t update the data in memory and return the updated data to the XML file.

In the DOM approach, the parser creates a tree of objects that represents the content and organization of data in the document. In this case, the tree exists in memory. The application can then navigate through the tree to access the data it needs, and if appropriate, manipulate it.

Now we have 2 technologies that do convert the XML document into java classes. You manipulate the Java object instead. However, JAXB and XmlBeans accomplish the marshalling and unmarshalling of XML document quite differently.

XMLBeans processes an XML document without going through a conversion into Java where integrity of the document can be lost. XMLBeans creates a cursor that can move through the XML document. You can access any element of the document, including comments and schema information because the document is kept in full fidelity. It also creates the opportunity to execute an XQuery on the document. XMLBeans also gives a strongly typed access to the document and a more generic type of access, similar to a reflection API. However, it doesn’t always work the way you want it. Many time an error like “Invalid XML character 0×0″ by processing the same document where the processing was previously successful.

More importantly, like I previously mentioned it, Using Xml Beans requires you to know XML very well and also SAX and DOM.

JAXB is binded to the XML schema, the first release of JAXB did not answer the development community, mainly because it did not support all XML schema features and only supported DTDs. The first JAXB version suffered mainly of 3 major issues: it prevented support of type substitution and related features, it prevented support for extensibility and versioning, it failed to provide readable bindings in many cases.

JAXB 2.0 was enhanced to fill up the gaps and provides full XML schema support, Java to XML Schema mapping, schema evolution and portability. For ease of development, JAXB has leveraged J2SE 5.0 features: generics for type safe collections enum type for binding of simple type with enumeration facets better support for XML schema types using datatypes in JAXP 1.3 leveraging JAXP 1.3 validation for smaller footprint more compact binding based on constraining facets defined in schema.

JAXB architecture was re-designed to assist with schema evolution and invalid XML content. JAXB has introduced a flexible unmarshalling mode that allows for unmarshalling of invalid XML content. Optional unmarshal time validation can be used by an application to detect invalid XML content and decide whether to terminate unmarshalling.

Let’s take an example to illustrate the basic usage of both technologies:

Let say we have a schema:

With XmlBeans:

PromotionDocument pdoc =
PromotionDocument.Factory.parse(new File (xmlFile));

// Get and print pieces of the XML instance.
Promotion p = pdoc.getPromotion;
with JAXB:
JAXBContext jc = JAXBContext.newInstance(”test.jaxb”);
Unmarshaller unmarshaller = jc.createUnmarshaller();
Promotion p = (Promotion) unmarshaller(new File(xmlFile) );

The choice between these technology depends on the performance you want to get
and the use of XML features. I will go with XML Beans if:

I would like to access the XML document itself and use XQueries …etc.

I would like Native DOM representation at the expense of performance and memory management.
Access schema metadata
Use it older JDK versions. 1.4 or older.

If you are looking for simplicity to convert an XML document Java classes,
JAXB is your choice.

If you want binding customization, JAXB allows these declarations to be made “inline” — that is, in the schema, or in a separate document.
JAXB uses memory efficiently: The tree of content objects produced through JAXB tends
can be more efficient in terms of memory use than DOM-based trees.

JAXB allows you to access XML data without having to unmarshal it. Once a schema is bound you can use the ObjectFactory methods to create the objects and then use set methods in the generated objects to create content.

Medical billing Software

Get helpful advice about the topic of internet marketing – go through this web site. The times have come when proper info is truly only one click away, use this chance.

Share and Enjoy:
  • Twitter in  XMLBeans Or JAXB  What To Choose
  • Delicious in  XMLBeans Or JAXB  What To Choose
  • Yiggit in  XMLBeans Or JAXB  What To Choose
  • Misterwong in  XMLBeans Or JAXB  What To Choose
  • Technorati in  XMLBeans Or JAXB  What To Choose
  • Printfriendly in  XMLBeans Or JAXB  What To Choose
  • Digg in  XMLBeans Or JAXB  What To Choose
  • Sphinn in  XMLBeans Or JAXB  What To Choose
  • Facebook in  XMLBeans Or JAXB  What To Choose
  • Linkarena in  XMLBeans Or JAXB  What To Choose
  • Googlebookmark in  XMLBeans Or JAXB  What To Choose
  • Live in  XMLBeans Or JAXB  What To Choose
  • Webnews in  XMLBeans Or JAXB  What To Choose
  • Mixx in  XMLBeans Or JAXB  What To Choose
  • Barrapunto in  XMLBeans Or JAXB  What To Choose
  • Bitacoras in  XMLBeans Or JAXB  What To Choose
  • Blinklist in  XMLBeans Or JAXB  What To Choose
  • Blogmarks in  XMLBeans Or JAXB  What To Choose
  • Blogmemes in  XMLBeans Or JAXB  What To Choose
  • Blogmemes in  XMLBeans Or JAXB  What To Choose
  • Blogospherenews in  XMLBeans Or JAXB  What To Choose
  • Blogter in  XMLBeans Or JAXB  What To Choose
  • Co Mments in  XMLBeans Or JAXB  What To Choose
  • Connotea in  XMLBeans Or JAXB  What To Choose
  • Current in  XMLBeans Or JAXB  What To Choose
  • Designfloat in  XMLBeans Or JAXB  What To Choose
  • Diigo in  XMLBeans Or JAXB  What To Choose
  • Dotnetkicks in  XMLBeans Or JAXB  What To Choose
  • Dzone in  XMLBeans Or JAXB  What To Choose
  • Ekudos in  XMLBeans Or JAXB  What To Choose
  • Fark in  XMLBeans Or JAXB  What To Choose
  • Bluedot in  XMLBeans Or JAXB  What To Choose
  • Fleck in  XMLBeans Or JAXB  What To Choose
  • Friendfeed in  XMLBeans Or JAXB  What To Choose
  • Fsdaily in  XMLBeans Or JAXB  What To Choose
  • Globalgrind in  XMLBeans Or JAXB  What To Choose
  • Gwar in  XMLBeans Or JAXB  What To Choose
  • Hackernews in  XMLBeans Or JAXB  What To Choose
  • Haohao in  XMLBeans Or JAXB  What To Choose
  • Healthranker in  XMLBeans Or JAXB  What To Choose
  • Hellotxt in  XMLBeans Or JAXB  What To Choose
  • Hemidemi in  XMLBeans Or JAXB  What To Choose
  • Hyves in  XMLBeans Or JAXB  What To Choose
  • Identica in  XMLBeans Or JAXB  What To Choose
  • Indianpad in  XMLBeans Or JAXB  What To Choose
  • Im in  XMLBeans Or JAXB  What To Choose
  • Kirtsy in  XMLBeans Or JAXB  What To Choose
  • Laaikit in  XMLBeans Or JAXB  What To Choose
  • Linkagogo in  XMLBeans Or JAXB  What To Choose
  • Linkedin in  XMLBeans Or JAXB  What To Choose
  • Linkter in  XMLBeans Or JAXB  What To Choose
  • Meneame in  XMLBeans Or JAXB  What To Choose
  • Misterwong in  XMLBeans Or JAXB  What To Choose
  • Msnreporter in  XMLBeans Or JAXB  What To Choose
  • Muti in  XMLBeans Or JAXB  What To Choose
  • Myshare in  XMLBeans Or JAXB  What To Choose
  • Myspace in  XMLBeans Or JAXB  What To Choose
  • N4g in  XMLBeans Or JAXB  What To Choose
  • Netvibes in  XMLBeans Or JAXB  What To Choose
  • Netvouz in  XMLBeans Or JAXB  What To Choose
  • Newsvine in  XMLBeans Or JAXB  What To Choose
  • Nujij in  XMLBeans Or JAXB  What To Choose
  • Ping in  XMLBeans Or JAXB  What To Choose
  • Posterous in  XMLBeans Or JAXB  What To Choose
  • Ppnow in  XMLBeans Or JAXB  What To Choose
  • Propeller in  XMLBeans Or JAXB  What To Choose
  • Ratimarks in  XMLBeans Or JAXB  What To Choose
  • Rec6 in  XMLBeans Or JAXB  What To Choose
  • Reddit in  XMLBeans Or JAXB  What To Choose
  • Scoopeo in  XMLBeans Or JAXB  What To Choose
  • Segnalo in  XMLBeans Or JAXB  What To Choose
  • Simpy in  XMLBeans Or JAXB  What To Choose
  • Slashdot in  XMLBeans Or JAXB  What To Choose
  • Socialogs in  XMLBeans Or JAXB  What To Choose
  • Sphere in  XMLBeans Or JAXB  What To Choose
  • Stumbleupon in  XMLBeans Or JAXB  What To Choose
  • Symbaloo in  XMLBeans Or JAXB  What To Choose
  • Techmeme in  XMLBeans Or JAXB  What To Choose
  • Thisnext in  XMLBeans Or JAXB  What To Choose
  • Tipd in  XMLBeans Or JAXB  What To Choose
  • Tumblr in  XMLBeans Or JAXB  What To Choose
  • Upnews in  XMLBeans Or JAXB  What To Choose
  • Webride in  XMLBeans Or JAXB  What To Choose
  • Wikio in  XMLBeans Or JAXB  What To Choose
  • Wikio in  XMLBeans Or JAXB  What To Choose
  • Wikio in  XMLBeans Or JAXB  What To Choose
  • Wists in  XMLBeans Or JAXB  What To Choose
  • Wykop in  XMLBeans Or JAXB  What To Choose
  • Xerpi in  XMLBeans Or JAXB  What To Choose
  • Yahoomyweb in  XMLBeans Or JAXB  What To Choose
  • Yahoobuzz in  XMLBeans Or JAXB  What To Choose

Didn't find what you were looking for?

Maybe this Google search will help you:





Comments are closed.