Glen Daniels : it's just metadata...
Updated: 7/10/2003; 12:09:46 PM.

 

Subscribe to "Glen Daniels" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.

 
 

Sunday, June 01, 2003
Objectifying XML (3:37:07 PM)

Note to self (and all y'all XML/Java weenies who might be interested) - read this paper on the XOBE (note: page is in german) project, which looks at first glance a lot like an attempt to do for Java what E4X is doing for ECMAScript.

The idea here is to deal with XML as XML, with a nice lightweight syntax for manipulating documents/fragments in your favorite programming language.  So for instance, instead of doc.getChildElement("foo").getChildElement("bar"), you can say doc.foo.bar directly.

This is a Great Thing, but it still leaves open the question of how/when to treat pieces of XML as the serializations of particular types of language objects with desired types and/or behavior.  A quick example:

<birthdays xmlns:xsd="<well-known-uri>"
xmlns:xsi="<ditto>">
<item>
<name>Martin Luther King, Jr.</name>
<date xsi:type="xsd:date">1929-01-15</date>
</item>
<item>
<name>George Washington</name>
<date xsi:type="xsd:date">1732-02-22</date>
</item>
</birthdays>

Assume we read this document into a variable "birthdays".  Wouldn't it be nice if you could say (pseudocode):

for (int i = 0; i < birthdays.item.length; i++) {
println "There are " + daysUntilAnniversary(birthdays.item[0].date) + " days 'til " +
birthdays.item[i] + "'s birthday.";
}
...
int daysUntilAnniversary(Date foo) { ... }

In other words, because we know what an xsd:date is, "birthdays.item[0].date" would become an actual Date object in your language of choice, on which you could do math, call methods, etc. instead of a generic "XMLNode" object.

There's a lot of controversy about the right way to do this (or whether to do it at all), but it seems certain that there are valid and appropriate uses for this kind of thing, both for serializing data structures which originated in programming languages as XML, and for taking XML data defined by schemas and easily manipulating it with 3GL/4GLs.  I'll try to go into this interesting topic in more detail in a later entry/essay.



Comments? []

© Copyright 2003 Glen Daniels.



Click here to visit the Radio UserLand website.

 


June 2003
Sun Mon Tue Wed Thu Fri Sat
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30          
May   Jul