Object-oriented serialization (Was Re: Some questions)
Colas Nahaboo
Colas.Nahaboo at sophia.inria.fr
Fri Dec 3 14:22:41 GMT 1999
Matthew Gertner writes:
> The aspects of
> object-oriented design that are missing are then inheritance and
> polymorphism.
In my opinion, things may be more simple. If SGML/XML had not been designed by
people living in a typeless world (text documents), XML could have provided a
much better medium to express object instances, with such a simple design as
getting rid of element contents, and allowing attributes contents to be XML,
e.g:
<Point
x=<Length unit="inches" value="12"/>
y=<Length unit="cm" value="2"/>
color=<RGB R=<Number base="16" value="FF"/> G="0" B="0"/>
/>
matching a C/C++/Java... declaration of Point as:
Point {
Length x;
Length y;
Color color;
};
As you can see, this would be a very elegant and natural way to express object
instances (aka serialization). One would of course need a schema language on
top of that (to express what I wrote in a C-like declaration), but having to tweak the "low-level" serialisation to fit in the
current XML1.0 recomendation is I think the original sin of XML, which
pollutes a lot of the discussions I see here. For instance the current drive
for removing attributes results from this.
But, just like RDF, we could standardise on this non-XML-1.0-compatible (lets
call it GXML for Generalized XML :-) representation, and devise a canonical
way to express it in XML. For instance:
<Point>
<_x><Length unit="inches" value="12"/></_x>
<_y><Length unit="cm" value="2"/></_y>
<_color><RGB G="0" B="0">
<_R><Number base="16" value="FF"/></_R>
</_color>
</Point>
but we could devise others...
--
Colas Nahaboo, Koala/Dyade/Bull @ INRIA Sophia, http://www.inria.fr/koala/colas
xml-dev: A list for W3C XML Developers. To post, mailto:xml-dev at ic.ac.uk
Archived as: http://www.lists.ic.ac.uk/hypermail/xml-dev/ and on CD-ROM/ISBN 981-02-3594-1
To unsubscribe, mailto:majordomo at ic.ac.uk the following message;
unsubscribe xml-dev
To subscribe to the digests, mailto:majordomo at ic.ac.uk the following message;
subscribe xml-dev-digest
List coordinator, Henry Rzepa (mailto:rzepa at ic.ac.uk)
More information about the Xml-dev
mailing list