XMLBeans

Information about XMLBeans

Apache XMLBeans
Developer:Apache Software Foundation
Latest release:2.3.0 / June 1, 2007
OS:Cross-platform
Genre:XML binding
License:Apache 2.0 License
Website:[1]


XMLBeans is a Java-to-XML binding framework which is part of the Apache Software Foundation XML project.

Description

XMLBeans is a tool that allows you to access the full power of XML in a Java friendly way. The idea is that 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 that you can then use to access and modify XML instance data. Using XMLBeans is similar to using any other Java interface/class: you will see methods like getFoo or setFoo, just as you would expect when working with Java. While a major use of XMLBeans is to access your XML instance data with strongly typed Java classes there are also APIs that allow you access to the full XML infoset (XMLBeans keeps XML Infoset fidelity) as well as to allow you to reflect into the XML schema itself through an XML Schema Object model.

What Makes XMLBeans Different

  1. Full XML Schema support.
  2. Full XML Infoset fidelity.


Full XML Schema support: XMLBeans fully supports XML Schema and the corresponding java classes provide constructs for all of the major functionality of XML Schema. This is critical since often you do not have control over the features of XML Schema that you need to work with in Java. Also, XML Schema oriented applications can take full advantage of the power of XML Schema and not have to restrict themselvs to a subset.

Full XML Infoset fidelity: When unmarshalling an XML instance the full XML infoset is kept and is available to the developer. This is critical because that subset of XML is not easily represented in Java. For example, order of the elements or comments might be needed in a particular application.

Objective

A major objective of XMLBeans has been to be applicable in all non-streaming (in memory) XML programming situations. You should be able to compile your XML Schema into a set of Java classes and know that
  1. you will be able to use XMLBeans for all of the schemas you encounter (even the warped ones) and
  2. that you will be able to get to the XML at whatever level is necessary - and not have to resort to multiple tools to do this.

APIs

To accomplish the above objectives, XMLBeans provides three major APIs:
  • XmlObject
  • XmlCursor
  • SchemaType
XmlObject: The java classes that are generated from an XML Schema are all derived from XmlObject. These provide strongly typed getters and setters for each of the elements within the defined XML. Complex types are in turn XmlObjects. For example getCustomer might return a CustomerType (which is an XmlObject). Simple types turn into simple getters and setters with the correct java type. For example getName might return a String.

XmlCursor: From any XmlObject you can get an XmlCursor. 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.

SchemaType: XMLBeans provides a full XML Schema object model that you can use to reflect on the underlying schema meta information. For example, you might want to generate a sample XML instance for an XML schema or perhaps find the enumerations for an element so that you can display them.

All of this was built with performance in mind. Informal benchmarks and user feedback indicate that XMLBeans is extremely fast.

Example

An example of a simple XML Schema Definition to describe a country is given below.

<xs:schema targetNamespace="http://www.openuri.org/domain/country/v1" xmlns:tns="http://www.openuri.org/domain/country/v1" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0"> <xs:element name="Country" type="tns:Country"/> <xs:complexType name="Country"> <xs:sequence> <xs:element name="Name" type="xs:string"/> <xs:element name="Population" type="xs:int"/> <xs:element name="Iso" type="tns:Iso"/> </xs:sequence> </xs:complexType> <xs:complexType name="Iso"> <xs:annotation><xs:documentation>ISO 3166</xs:documentation></xs:annotation> <xs:sequence> <xs:element name="Alpha2" type="tns:IsoAlpha2"/> <xs:element name="Alpha3" type="tns:IsoAlpha3"/> <xs:element name="CountryCode" type="tns:IsoCountryCode"/> </xs:sequence> </xs:complexType> <xs:simpleType name="IsoCountryCode"> <xs:restriction base="xs:int"> <xs:totalDigits value="3"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="IsoAlpha2"> <xs:restriction base="xs:string"> <xs:pattern value="[A-Z]{2}"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> <xs:simpleType name="IsoAlpha3"> <xs:restriction base="xs:string"> <xs:pattern value="[A-Z]{3}"/> <xs:whiteSpace value="collapse"/> </xs:restriction> </xs:simpleType> </xs:schema>

When the schema is compiled into XMLBean classes (e.g., using Ant), it is very easy to create and manipulate XML data that conforms to the schema definition. The following Java code is a simple example that illustrates how an XML document can be created and validated.

import org.openuri.domain.country.v1.Country; import org.openuri.domain.country.v1.Iso;
public class CountrySample { public static void main(String[] args) { Country country = Country. Factory.newInstance(); country.setName("Denmark"); country.setPopulation(5450661); // from wikipedia :-) // print out country XMLBean as XML System.out.println(country.xmlText()); // check if document is valid - will print "Document is invalid" // because required Iso child element in not in the object System.out.println ("Document is " + (country.validate() ? "valid" : "invalid")); // add child with complex type Iso to make the document valid Iso iso = country.addNewIso(); iso.setAlpha2("DK"); iso.setAlpha3("DNK"); iso.setCountryCode(208); // print out country XMLBean as XML System.out.println(country.xmlText()); // check if document is valid - will print "Document is valid" System.out.println ("Document is " + (country.validate() ? "valid" : "invalid")); } }

History

David Bau initiated the XMLBeans project while he was working for BEA (he now works for Google). He was the chief designer of the tool, and he led the team that designed and implemented XMLBeans 1.0.

XMLBeans started on the grounds of XMLMaps an XML binding tool included in previous BEA WebLogic products. XMLBeans was originally developed as part of the proprietary BEA WebLogic Workshop Framework, but it was obvious from interviews conducted when it was first announced on January 27, 2003, that BEA wanted it to become an open standard. At that time it was not decided which organisation BEA wanted to involve in the standardisation effort. Later that year it was donated to the Apache Software Foundation.
  • January 27, 2003: BEA announces XMLBeans as a technology preview.
  • September 24, 2003: BEA donates XMLBeans to the Apache Software Foundation where it joins the Apache Incubator Project.
  • April 23, 2004: XMLBeans Version 1.0.2 is released. This is the first release from the incubator project.
  • June 25, 2004: XMLBeans graduated out of the Apache Incubator Project to become top level project.
  • June 30, 2005: XMLBeans Version 2.0 is released.
  • November 16, 2005: XMLBeans Version 2.1 is released.
  • June 23, 2006: XMLBeans Version 2.2 is released.
  • June 1, 2007: XMLBeans Version 2.3 is released.

See also

External links

Software development is the translation of a user need or marketing goal into a software product.[1][2] Software development is sometimes understood to encompass the processes of software engineering combined with the research and goals of software marketing
..... Click the link for more information.
Apache Software Foundation

Type 501(c)(3)
Founded June 1999
Headquarters Forest Hill, Maryland
Website www.apache.org The Apache Software Foundation (ASF) is a non-profit corporation (classified as 501(c)(3) in the United States) to support Apache software
..... Click the link for more information.
Code complete redirects here. For the Microsoft book, see Code Complete.

A software release is the distribution, whether public or private, of an initial or new and upgraded version of a computer software product.
..... Click the link for more information.
June 1 is the 1st day of the year (2nd in leap years) in the Gregorian calendar. There are 0 days remaining.

Events

  • 193 - Roman Emperor Didius Julianus assassinated.

..... Click the link for more information.
20th century - 21st century - 22nd century
1970s  1980s  1990s  - 2000s -  2010s  2020s  2030s
2004 2005 2006 - 2007 - 2008 2009 2010

2007 by topic:
News by month
Jan - Feb - Mar - Apr - May - Jun
..... Click the link for more information.
An operating system (OS) is the software that manages the sharing of the resources of a computer. An operating system processes system data and user input, and responds by allocating and managing tasks and internal system resources as a service to users and programs of the
..... Click the link for more information.
Cross-platform is a term which can refer to computer programs, operating systems, computer languages, programming languages, or other computer software and their implementations which can be made to work on multiple computer platforms.
..... Click the link for more information.
Computer software can be organized into categories based on common function, type, or field of use. A list follows of common software categories.

Categories of software

  • Applications

..... Click the link for more information.
XML data binding refers to the process of representing the information in an XML document as an object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM to retrieve the data from a direct representation of the XML
..... Click the link for more information.
A software license comprises the permissions, rights and restrictions imposed on software (whether a component or a free-standing program). Use of software without a license could constitute infringement of the owner's exclusive rights under copyright or, occasionally, patent law
..... Click the link for more information.
Apache License
Author: Apache Software Foundation
Version: 2.0
Copyright on the license: Apache Software Foundation
Publication date: January 2004
OSI approved: Yes
Debian approved: Yes
Free Software: Yes

..... Click the link for more information.
A website (alternatively, Web site or web site) is a collection of Web pages, images, videos or other digital assets that is hosted on one or several Web server(s), usually accessible via the Internet, cell phone or a LAN.
..... Click the link for more information.
Java

Paradigm: Object-oriented, structured, imperative
Appeared in: 1995
Designed by: Sun Microsystems
Typing discipline: Static, strong, safe, nominative
Major implementations: Numerous
Influenced by: Objective-C, C++, Smalltalk, Eiffel,[1]
..... Click the link for more information.
XML data binding refers to the process of representing the information in an XML document as an object in computer memory. This allows applications to access the data in the XML from the object rather than using the DOM to retrieve the data from a direct representation of the XML
..... Click the link for more information.
A framework is a basic conceptual structure used to solve a complex issue. This very broad definition has allowed the term to be used as a buzzword, especially in a software context.
..... Click the link for more information.
Apache Software Foundation

Type 501(c)(3)
Founded June 1999
Headquarters Forest Hill, Maryland
Website www.apache.org The Apache Software Foundation (ASF) is a non-profit corporation (classified as 501(c)(3) in the United States) to support Apache software
..... Click the link for more information.
Extensible Markup Language

File extension: .xml
MIME type: application/xml, text/xml (deprecated)
Uniform Type Identifier: public.xml
Developed by: World Wide Web Consortium
Type of format: Markup language
Extended from: SGML
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
XML Information Set (Infoset) is a W3C specification describing an abstract data model of an XML document in terms of a set of information items. The definitions in the XML Information Set specification are meant to be used in other
..... Click the link for more information.
XML schema is a description of a type of XML document, typically expressed in terms of constraints on the structure and content of documents of that type, above and beyond the basic syntax constraints imposed by XML itself.
..... Click the link for more information.
XML Information Set (Infoset) is a W3C specification describing an abstract data model of an XML document in terms of a set of information items. The definitions in the XML Information Set specification are meant to be used in other
..... Click the link for more information.
Apache Ant is a software tool for automating software build processes. It is similar to make but is written in the Java language, requires the Java platform, and is best suited to building Java projects.
..... Click the link for more information.
BEA Systems, Inc.

Public (NASDAQ:  BEAS )
Founded 1995
Headquarters San Jose, California, USA

Key people Alfred Chuang, Founder, Chairman & CEO
Mark Dentinger, EVP & CFO
Tom Ashburn, President, Worldwide Field Organization
..... Click the link for more information.
Google Inc.

Public (NASDAQ:  GOOG ), (LSE:  GGEA )
Founded Menlo Park, California (September 7 1998[1])
Headquarters Mountain View, California, USA

Key people Eric E.
..... Click the link for more information.
BEA WebLogic is a J2EE Platform product family that includes:
  • A J2EE application server, WebLogic Server
  • An enterprise portal, WebLogic Portal
  • An Enterprise Application Integration platform
  • A transaction server and infrastructure, WebLogic Tuxedo

..... Click the link for more information.
BEA WebLogic is a J2EE Platform product family that includes:
  • A J2EE application server, WebLogic Server
  • An enterprise portal, WebLogic Portal
  • An Enterprise Application Integration platform
  • A transaction server and infrastructure, WebLogic Tuxedo

..... Click the link for more information.
Apache Incubator is the gateway for projects hoping to become fully fledged Apache Software Foundation projects.

The Incubator project was created in October of 2002 to provide an entry path to the Apache Software Foundation for projects and codebases wishing to become part
..... Click the link for more information.
Java Architecture for XML Binding (JAXB) allows Java developers to map Java classes to XML representations. JAXB provides two main features: the ability to marshal Java objects into XML and the inverse, i.e. to unmarshal XML back into Java objects.
..... Click the link for more information.
Apache Software Foundation

Type 501(c)(3)
Founded June 1999
Headquarters Forest Hill, Maryland
Website www.apache.org The Apache Software Foundation (ASF) is a non-profit corporation (classified as 501(c)(3) in the United States) to support Apache software
..... Click the link for more information.
Apache ActiveMQ is an open source (Apache 2.0 licensed) message broker which fully implements the Java Message Service 1.1 (JMS). It provides "Enterprise Features"[1]
..... Click the link for more information.

This article is copied from an article on Wikipedia.org - the free encyclopedia created and edited by online user community. The text was not checked or edited by anyone on our staff. Although the vast majority of the wikipedia encyclopedia articles provide accurate and timely information please do not assume the accuracy of any particular article. This article is distributed under the terms of GNU Free Documentation License.