JiBX: Binding XML to Java Code

# JiBX: Binding XML to Java Code |

JiBX Basics Overview Flexibility Performance Clean code News and Status User Comments Sponsors Support and Training Bugs Getting Started Binding Tutorial A basic binding Binding extras Structure mapping Collections and arrays Using mappings Advanced binding Method hooks Custom code Binding Compiler Binding on Load Runtime JiBX Extras Building JiBX Schema Compatibility Mailing Lists FAQ Contributing License Binding Definition Definition details Definition contexts Conversions XML summary <binding> element <include> element <format> element <namespace> element <mapping> element <value> element <structure> element <collection> element Attribute groups Usage API Runtime JavaDocs Subprojects Eclipse Plug-in Introduction Install Usage Generator Tools Axis2 Usage JibxSoap Xsd2Jibx | ### What is JiBX? JiBX is a framework for binding XML data to Java objects. It lets you work with data from XML documents using your own class structures. The JiBX framework handles all the details of converting your data to and from XML based on your instructions. JiBX is designed to perform the translation between internal data structures and XML with very high efficiency, but still allows you a high degree of control over the translation process. How does it manage this? JiBX uses binding definition documents to define the rules for how your Java objects are converted to or from XML (the binding). At some point after you've compiled your source code into class files you execute the first part of the JiBX framework, the binding compiler. This compiler enhances binary class files produced by the Java compiler, adding code to handle converting instances of the classes to or from XML. After running the binding compiler you can continue the normal steps you take in assembling your application (such as building jar files, etc.). You can also skip the binding compiler as a separate step and instead bind classes directly at runtime, though this approach has some drawbacks. The second part of the JiBX framework is the binding runtime. The enhanced class files generated by the binding compiler use this runtime component both for actually building objects from an XML input document (called unmarshalling, in data binding terms) and for generating an XML output document from objects (called marshalling). The runtime uses a parser implementing the XMLPull API for handling input documents, but is otherwise self-contained. This approach gives several important benefits: Flexibility - Use any class structure you want, so long as you can tell JiBX how to translate it to and from XML. Performance - Pull parsing and class file enhancement techniques let JiBX build high-performance marshalling and unmarshalling code directly into your classes. Clean code - You write the code and JiBX works with it, not the other way around! We're not aware of any recent published performance comparisions between data binding frameworks, but you can view some older results from the BindMark tests, along with a similar study focused around Web services performance.. These sets of results are both from late 2005, but to our knowledge there haven't been any significant changes in performance since then. You can also see the earlier performance study by JiBX author Dennis Sosnoski, Data Binding, Part 2: Performance, on the IBM developerWorks XML Zone. Besides these performance issues, Dennis has also covered the JiBX 1.X code generation architecture, and several aspects of the JiBX 2.0 design, in his developerWorks Java Classworking Toolkit column. If you're using JiBX in your development work, check out the JiBX page on the Ohloh Open Source networking site and consider listing yourself as a user. Ohloh is a great site for tracking the open source software that developers are using, and you get to rate the projects based on your experience or even write a review that can help out other developers considering a project.