News

BEA's XML Beans are cooking

[February 11, 2003] - It's been more than four years since programmers first began to merge XML data and schema with Java via raw APIs. They need this to create Web services, or for storing configuration or other application data. A variety of protocols have come along since then, but marrying XML to Java is still a difficult process that few enjoy.

Java application server leader BEA recently took a step toward addressing the problems of developers who are trying to write Java apps that use XML with the launch of XML Beans, presently available as an online technology preview.

''Today, people get to XML through low-level APIs, such as SAX or DOM, that give them access to XML,'' said Carl Sjogeren, product manager, WebLogic Workshop, BEA. While this gives you access, the resultant code can be brittle, especially when application structure changes, he said.

Another approach is to apply bindings. These extract data from the XML stream and put it into Java classes.

''But the issue there is that you have to force-fit the XML to suit Java,'' said Sjogeren. Validation rules, ordering constraints, comments and the like can be lost.

XML Beans tries to provide a ''best of both worlds'' solution. Instead of ''force-fitting,'' it leaves XML unchanged and gives a Java view of that XML data, without loss of information.

This is as close as you can get to obtaining an XML data type in the Java world, suggested Sjogeren, ''without changing the Java language itself.''

Related Stories and Links:
The technology preview of BEA's XMLBeans Service is available as a free, hosted service at http://dev2dev.bea.com/techtrack/detail.jsp?highlight=xmlbeans

''Improvements mark evolving Java servers'' by Jack Vaughan, February 2003. Please go to http://www.adtmag.com/article.asp?id=7208

''What's behind BEA's big bet on tools?'' by Jack Vaughan, August 2002. Please go to http://www.adtmag.com/article.asp?id=6509

For other Programmers Report articles, please go to http://www.adtmag.com/article.asp?id=6265

About the Author

Jack Vaughan is former Editor-at-Large at Application Development Trends magazine.