XML 2003 logo

XBinder XML Schema to C Compiler

Abstract

The subject of the proposed XML product presentation is "XBinder - An XML Schema to C Data Binding Tool". The intended audience is software developers who work with XML.

XML Data Binding refers to the automatic generation of computer language source code corresponding to an XML DTD or Schema. It is gaining increasing popularity as an alternative API to SAX or DOM. The advent of XML Schema has made this a logical alternative because the types described by schema have a logical equivalent in most modern computer languages. This allows developers to work with classes and structures in the language they are accustomed to and concentrate on business processes and rules and not on the details of encoding and decoding the data in XML.

The Objective Systems XBinder tool is a new product that generates C code to encode/decode XML messages. It is similar to the Sun JAXB data binding framework except that it generates C code instead of Java.

Comparison with SAX and DOM

The "Simple API for XML" (SAX) and "Domain Object Model" (DOM) are the two most well-known methods for programmatically working with XML at this time. SAX is not an established standard, but rather a de-facto standard. It uses a callback system in which user-defined event handlers are invoked as an XML document is parsed. DOM, on the other hand, is an established W3C standard. It provides the user with a standard tree structure for describing all of the items within an XML document.

The primary difference between XML Data Binding and these two approaches is that SAX and DOM provide for an "interpreted" representation of an XML document that is generic and applicable to all documents. XML Data Binding on the other hand is a "compiled" solution that generates code specific to a given XML Schema or DTD. The compiled solution cannot be used with an XML document that does not correspond to the given schema.

Computer Language Bindings

XML Data Binding is used to create specific computer language bindings for a given DTD or XML schema. Currently, Java and C/C++ are the most common languages used.

Java would appear to be the most common language used for binding at this time due to its widespread use in network and XML-based applications. Sun Microsystems, as part of its "Java Community Process" (JCP), has created a standard for binding Java to XML Schema or DTD's. This is the "Java Architecture for XML Binding" (JAXB) standard. Open source implementations of XML to Java Data Binding applications currently exist. Two of the more well known of these are Castor and Zeus.

C/C++ is also a common language for XML network applications and some binding work has begun in this area. A common tool in use in OSI networking has been the "ASN.1 compiler" which creates C/C++ bindings from ASN.1 - a predecessor to XML Schema. New XML schema compilers are now being developed based using the same methodologies that went into developing ASN.1 compilers.

XBinder Product Details

The XBinder product will be examined to show how it reduces the effort required to create and work with XML documents that are compliant with a schema.

The following details on the product will be presented:

* The data bindings of XML schema types to C types.

* Procedures for encoding and decoding XML messages.

* Details on the different types of source files that are generated.

* Details on how entities such as facets, attributes, and global elements are handled.

The presentation will end by looking at a complete example of an XSD to C binding.

Keywords


1. Product Presentation Paper

Since this was a product presentation, no paper was prepared for the proceedings.

Biography

Founder and principal engineer of Objective Systems, Inc., a company dedicated to the implementation of data communications messaging standards. Mr. Day has over 20 years of exerience in the IT industry as a programmer and consultant in the areas data communcations using several standards-based technologies (ASN.1, XML, and CORBA).