XML as an alternative to Object Serialization?
Peter Murray-Rust
peter at ursus.demon.co.uk
Fri Jan 16 11:38:11 GMT 1998
At 18:39 13/01/98 -0500, Tyler Baker wrote:
>
>
>Steven Ball wrote:
>
>>
>> I have done this as part of my TclXML package - an XML generator.
>> The generator takes a XML DTD and creates a Tcl command for each element
>> and entity. A Tcl script then calls these commands, nested to reflect the
>> resultant document's structure, with appropriate arguments for attributes,
>> to produce an XML document.
>>
[Haven't seen the full posting... has TclXML been announced?]
>
> Looked at it briefly and seemed like a great tool for webmasters and web
>content developers, but I am doing work for a standalone application so
that is
>why I need to do this within Java only.
Tcl is a great language for this sort of thing. Joe English wrote CoST in
tcl and I added a tk GUI (costwish) which took exactly this approach. (I
even used colonized names :-). I miss the ability in Java to add
scripts/commands to elements "in clear". The JUMBO approach is to create a
Java class for each element (or the subset that I don't want default
processing for) and to point to this class (bytecode) using a schema file
(using the prototypic namespace ideas in the public domain). Example:
<?xml:namespace href="jumbo/play/schema.xml" as="PLAY"?>
points <PLAY:STAGEDIR> to the PLAY namespace. Within the schema file is
something like:
...
<ELEMENT NAME="STAGEDIR">
<HELP>... lots of lovely XML-structured help ...</HELP>
<JAVA>jumbo.play.STAGEDIRNode.class</JAVA>
<ICON>jumbo/play/stagedir.gif</ICON>
</ELEMENT>
Of course I make this up as I go along, and I hope that there will be some
public confluence of approaches here :-). The software is then able to:
- recognise PLAY:STAGEDIR as belonging to a schema.
- find the icon and draw a pretty picture
- locate the help tree under a help icon
- load the STAGEDIRNode class. This class overrides some or all methods
such as process(), display(), toString(), toSGML(),
drawUnscaledObject(Graphics), editContent(), editAttributes(). etc.
(Of course editContent() is a no-op for PLAY :-)
If the document contains a single namespace, but does not have colonized
names, or has colonized names and non-colonized names I have a fudge which
works quite nicely but probably shouldn't be publicly posted :-) or it
might make some people ill.
P.
BTW I shall be releasing a new snapshot of JUMBO with this feature before
Feb 4 (that's a deadline).
Peter Murray-Rust, Director Virtual School of Molecular Sciences, domestic
net connection
VSMS http://www.nottingham.ac.uk/vsms, Virtual Hyperglossary
http://www.venus.co.uk/vhg
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/
To (un)subscribe, mailto:majordomo at ic.ac.uk the following message;
(un)subscribe 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