Re: [xml-dev] how to best integrate XML in a programming language

From
George Richard Russell <>
To
Burak Emir <>
Date
2004-02-18T11:36:32Z
ID
<>
Thread
Re: [xml-dev] how to best integrate XML in a programming language
OK, up front I'll say a dual view of data is imo better than a single 
view. The two views are labelled tree i.e. DOM like and Regular data 
structures (i.e. records, collections, objects, scalar types).

They neat thing is being able to choose within the same program, over 
the same data, which view is most convenient for the task at hand.
The assertion of the regular structure over the tree needs a dynamic 
check, but the use of the regular strcture in programs can itself be 
statically checked.

There are couple of papers outlining what a language could look like, 
mostly from a largely untyped / dynamically typed aspect.

Hybrid Applications over XML - Integrating the Declarative and 
Navigational Approaches - 
http://www.cis.strath.ac.uk/~david/papers/widm2002.pdf

Projector - a partially typed language for querying XML
http://www.cis.strath.ac.uk/~david/papers/planx2002.pdf

> <point>
> No matter whether you are more concerned about documents or data, 
> writing code in non-XML syntax makes life easier.
> </point>
> 
> I believe it is better to write
> out.println( <html>... </html>.serialize() );

Please, an implicit conversion to String!

> because a compiler can check many of the well-formedness constraints. It 
> is thus less likely that a typo will break your neck at runtime. Plus a 
> very sophisticated type system could even check whether your value 
> conforms to some type specified in DTD, Relax NG or Schema - this is 
> something like "built-in data binding".

Note that some data binding frameworks provide a dual view of data i.e. 
XMLBeans provides an Infoset and a typed, object representation.

> - Which type does the XML literal have ?
>    (This demands a class library that represents XML, which is ideally 
> not as bloated as DOM)

Labelled tree at least, possibly a more specific type assertion made at 
runtime or statically as needed.

Scala looks an interesting language.

George Russell