V-DOM and P-XML—towards a valid programming of XML-based applications

Martin Kempa, Volker Linnemann
2002 Information and Software Technology  
There is an emerging amount of software for generating and manipulating XML documents. This paper addresses the problem of guaranteeing the validity of dynamically generated XML structures statically at compile time. In the XOBE (XML OBJECTS) project XML Schema is used for describing sets of valid XML documents. An XML schema provides a vehicle to define new classes, i.e. each element declaration in a schema defines a new class of objects (XML objects). Each object within a class represents an
more » ... ML structure which is valid according to the underlying XML schema. XML objects are created by a new language construct called XML object constructor. XML object constructors are expressed in XML syntax. Previously generated XML objects can be inserted according to the declared XML schema. The main focus of the paper is the type system of XOBE. Among others, this type system provides the basis for checking the validity of assignments of XML objects to variables. The type system will be described and we present formally a type checking algorithm based on this type system. Related Work Run time validation. The most elementary way to deal with XML fragments is to treat XML documents as ordinary strings without any structure. One prominent representative of this technique is given by Java Servlets [Wil99] . In former CGI scripts [Gai95] the programming language Perl [WS92] was used. The technique is rather tedious when constant XML fragments are being generated. Java Server Pages [PLC99, FK00] provide an improvement over pure string operations by allowing to switch between XML parts and Java. This switching is done by special markings. Java Server Pages share with string operations the disadvantage that not even well-formedness is checked at compile time. An improvement is to provide classes for nodes of an XML document tree thus allowing to access and manipulate arbitrary XML fragments by object-oriented programming. Representatives of this approach, sometimes called low-level bindings, are the Document Object Model (DOM) [W3C98a] and Java DOM (JDOM) [JDO]. Both are widely accepted and supported. It is the only standardized and language independent way for XML processing. Constant XML fragments can be programmed in a pure object-oriented manner, which is rather tedious, or by parsing an XML fragment into the object structure, which requires runtime validation. Low-level bindings ensure well-formedness of dynamically generated documents at compile time, but defer validation until runtime. Partial compile time validation. A series of proposals [Bou02], called high-level bindings, have been presented. With Sun's JAXB, Microsoft's .Net Framework, Exolab's Castor, Delphi's Data Binding Wizard, Oracle's XML Class Generator [Sun01, Mic01, Exo01, Bor01 , Ora01] we only mention the better known products. These approaches assume that all processed documents follow a given schema. This description is used to map the docu-
doi:10.1016/s0950-5849(02)00012-5 fatcat:57cwma3mtjcoxndyin53jl5xsa