Browse DevX
Sign up for e-mail newsletters from DevX


Use XMLBeans to Manage Multi-version XML

XML version management can be a real pain point in integrated Web services applications. Learn how to handle it with XMLBeans.




Building the Right Environment to Support AI, Machine Learning and Deep Learning

he integration of heterogeneous software systems often requires disparate clients to share data seamlessly in real time. Two technologies that have eased this data flow are XML and Web services, which use SOAP to make the integration more seamless.

One way to handle data exchange within a Web service application is to publish an XSD (XML Schema Definition) that requires all client applications to send XML data that's compliant with the published XSD. As long as you maintain a single XSD and all your clients' XML complies with it, your Web service will run with no problems. However, life in the software industry is seldom smooth. The software requirements involved in systems integration change frequently and you need to accommodate them. However, once you've published an XSD that all clients use, modifying it becomes complicated since any changes affect all the clients as well. Alternatively, you could publish multiple versions of the XSD and process different incoming XML versions in your application.

This article examines the problem of version management in an integrated application and demonstrates how to handle it with XMLBeans, the latest addition to the Java family of parsers.

Introduction to XMLBeans
XMLBeans is a Java-XML binding tool that enables you to access the full power of XML in a Java-friendly way. With XMLBeans, you get a familiar Java object-based view of XML data without losing the richness of the native XML structure and schema.

The starting point for XMLBeans is XML schema. A schema (contained in an XSD file) is an XML document that defines a set of rules to which other XML documents must conform.

You compile the schema (XSD) file to generate a set of Java interfaces that mirror the schema. With these compiled classes, you process XML instance documents that conform to the schema. You bind an XML instance document to the compiled classes; changes made through the Java interface change the underlying XML representation.

XML programming interfaces (such as DOM or SAX) or an XML marshalling/binding tool (such as JAXB) lacks strong schema-oriented typing. Navigation in a DOM-oriented model is "space inefficient" for large documents, and JAXB provides support for the XML but does not support all its features such as namespace binding. XMLBeans is fast, space efficient, rich in functionality, and easy to use.

Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date