Object-oriented serialization (Was Re: Some questions)
Vane Lashua
vlashua at RSGsystems.com
Fri Dec 3 16:06:44 GMT 1999
I think you're mixing apples and oranges.
An even simpler declaration of your example below -- and correct in XML --
would be:
<Point value="12in,2cm;RFFx,G0,B0" />
or:
<processingsegment lang="Java" content="Point {Length x; Length y; Color
color;};" />
or:
<? Java Point {Length x; Length y; Color color;}; ?>
XML is a storage medium. Java source code is a storage medium. XML may
contain Java source code syntax, as Java source code may contain XML syntax,
but both need processors to do more.
And by the way, SGML grew out of a world of extremely limited and narrowly
typed data processing _and_ fixed length records. Data typing in SGML is as
simple as adding an attribute to an element declaration. It is up to a
processor to know how to use it. Just as it is in Java.
Vane
-----Original Message-----
From: Colas Nahaboo [mailto:Colas.Nahaboo at sophia.inria.fr]
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)
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