XMLBeans is an XML parser developed by BEA Systems for WebLogic 8.1. XMLBeans has recently been released as an open source initiative. Plenty of parsers and Application Programming Interfaces (APIs) are available in the market, for handling XML. XMLBeans is different from the typical XML parser, as it is designed to build applications based on known, specific schemas.
The XMLBeans provides a schema compiler that parses an XSD file and creates a JAR. The JAR contains a bunch of Java classes that developers can use to manipulate instance documents as if they were normal Java types.
Using XMLBeans, you can get an object-based view of the underlying XML data, without losing access to the original XML structure. This may seem similar to the APIs that allow you to map Java classes to document elements, but it differs in one major aspect. XMLBeans doesn't take the XML apart in order to bind to its parts.
Using XMLBeans, you can either handle the entire instance document as a whole or create the instance documents in Java by manipulating the classes that have been built for you by the XMLBeans compiler. This is usually done via regular bean-like access, using the get and set methods.
XMLBeans provides an XQuery parser and XMLCursor objects that allow you to query your documents with the flexibility of a SQL database. XMLBeans was originally created because of the need seen by developers, for a more XML centric Java binding model that no other product available in the market offered.
XMLBeans 1.0 has been successfully used as an underlying technology for several products as well as by a growing number of large users including some of the largest companies in the world.
As XMLBeans allows you to access the full power of XML in a Java friendly way, it is an XML-Java binding tool. Using XMLBeans, you can take advantage of the richness and features of XML and XML Schema and have these features mapped as naturally as possible to the equivalent Java language and typing constructs.
XMLBeans uses XML Schema to compile Java interfaces and classes. You can use these Java interfaces and classes later to access and modify XML instance data. Using XMLBeans is similar to using any other Java interface/class. One of the main use of XMLBeans is to access your XML instance data with strongly typed Java classes.
There are also certain API's provided by XMLBeans that allow you access the full XML infoset as well as to allow you to reflect into the XML schema itself through an XML Schema Object model.
There are two major factors that make XMLBeans unique from the other XML-Java binding options. The factors include full XML Schema support and full XML infoset fidelity. XMLBeans fully supports XML Schema and the corresponding java classes provide constructs for all of the major functionality of XML Schema. This is critical, as usually you do not have control over the features of XML Schema that you need to work with in Java.
In addition, the XML Schema oriented applications can take full advantage of the power of XML Schema and need not restrict themselves to a subset.
The full XML infoset is made available to the developer, when unmarshalling an XML instance. This is critical, as the subset of XML is not easily represented in Java. For example, order of the elements or comments might be needed in a particular application. One of the main objective of XMLBeans is to be applicable in all non-streaming XML programming situations.
You should be able to compile your XML Schema into a set of java classes and know that you will be able to use XMLBeans for all of the schemas you encounter and to get to the XML at whatever level is necessary without the need for multiple tools.
XMLBeans provides three important APIs to accomplish the objective of being able to be used in all non-streaming XML programming situations. The three APIs include XMLObject, XMLCursor, and SchemaType. The java classes that are generated from an XML Schema are all derived from XmlObject.
The java classes provide strongly typed getters and setters for each of the elements within the defined XML. The complex types are in turn XmlObjects. For example getEmployee returns an EmployeeId which is an XmlObject. Simple types turn into simple getters and setters with the correct Java type. For example, getEmployeeName returns a string.
You can get an XmlCursor from any XmlObject. This provides efficient, low level access to the XML Infoset. A cursor represents a position in the XML instance. You can move the cursor around the XML instance at any level of granularity you need from individual characters to Tokens.
XMLBeans provides a full XML Schema object model that you can use to reflect on the underlying schema meta information. For example, to generate a sample XML instance for an XML schema or to find the enumerations for an element to display them. These APIs help improve the performance and processing speed of XMLBeans.
The future of XMLBeans is exciting. XMLBeans is a great, stable technology that will continue to improve going forward. With greater emphasis on full support for XML Schema and the XML Infoset along with it's performance characteristics, XMLBeans is the best choice for in-memory XML-Java programming.
New versions of XMLBeans with additional powerful functionalities are in the process of development. It has been observed that the XML-Java binding occurs in situations where XMLBeans could be optimized for areas such as Web Services and Java to XML Schema scenarios.
Copyright - © 2004 - 2018 - All Rights Reserved.