In todays web applications we face the problem that there is the world of HTML and XML on one side and the world of objects (primarily Java objects) on the other side. Programs generating XML and HTML, for example Java Servlets, either have to generate and analyze XML on a string-basis which is rather tedious or have to generate object structures in the document object model or in JAXB. This requires to switch between XML strings and corresponding objects manually by programming. Moreover, the object structure is not guaranteed to conform to an underlying document type definition DTD or XML schema. Although the goal of JAXB is to guarantee this validity, it is only achieved up to a certain extent. In many cases, expensive runtime testing of validity is necessary by using a validation method provided by JAXB. Moreover, in JAXB XML strings and XML objects are two different things requiring to switch between these two notions by methods called marshalling and unmarshalling. In this paper we propose that in object oriented programming with XML there should be no distinction between XML documents and XML objects. In other words, XML in an object oriented program always denotes XML objects, i.e. generating and analyzing XML is done conceptually only on the basis of objects. We propose, similarly to JAXB, to have a class for every element type of a DTD or an XML schema. In contrast to JAXB, these classes are defined such that the generation of XML objects is done in a syntax oriented manner allowing to check the validity of all generated XML structures, i.e. XML objects, statically by the compiler. We believe that by eliminating the difference between XML objects and XML documents and by introducing absolutely type safe tools for generating XML objects, programming of web applications, i.e. Java Servlets, is much easier, much safer and much less error-prone.
[1]
Michael Kay,et al.
XSLT Programmer's Reference
,
2000
.
[2]
Derick Wood,et al.
Regular tree and regular hedge languages over unranked alphabets
,
2001
.
[3]
Volker Linnemann,et al.
V-DOM and P-XML - Towards a Valid Programming of XML-Based Applications
,
2002,
Inf. Softw. Technol..
[4]
Andreas Renner.
XML data and object databases: the perfect couple?
,
2001,
Proceedings 17th International Conference on Data Engineering.
[5]
Steven J. DeRose,et al.
XML Path Language (XPath) Version 1.0
,
1999
.
[6]
Ken Arnold,et al.
The Java Programming Language
,
1996
.
[7]
Duane Kimbell Fields,et al.
Web Development with Java Server Pages
,
2001
.
[8]
Larry Wall,et al.
Programming Perl
,
1991
.
[9]
Alan R. Williamson.
Java Servlets by Example
,
1999
.
[10]
Benjamin C. Pierce,et al.
Regular expression types for XML
,
2000,
TOPL.
[11]
Claus Brabrand,et al.
Static validation of dynamically generated HTML
,
2001,
PASTE '01.
[12]
Dan Suciu,et al.
Data on the Web: From Relations to Semistructured Data and XML
,
1999
.
[13]
not Cwi,et al.
XHTML™ 1.0 The Extensible HyperText Markup Language
,
2002
.
[14]
James Gosling,et al.
The Java Programming Language" The Java Series
,
1996
.