Re: ANNOUNCE: XML Tools 2.3.2
Re: ANNOUNCE: XML Tools 2.3.2
- Subject: Re: ANNOUNCE: XML Tools 2.3.2
- From: email@hidden
- Date: Wed, 21 Nov 2001 11:41:35 EST
I'm just not grokking the utility of XML tools as implemented. I need some
meta-insight.
<wax philosophical>
In 1996 I had a mini-epiphany when I finally grokked object oriented
programming, or, more exactly, object oriented data and the concept of
instantiation. Instead of data being the slave of the
grid/table/format/structure in which it was placed (eg. a spreadsheet),
"object oriented" data carries with it it's own world of self definitions (in
other words, the focus of attention is the object, not the categories, hence
"object oriented").
For example, I could have a piece of data (my Javascript roots will show thru
here) called "fact". This data could have attributes, eg fact.size,
fact.color, fact.price. I might have thousands of individual facts, and might
put them in an array, fact[x], and have fact[1].color, etc. (or
fact["chair"].size). Perhaps with fact[4] I might want to have another
attribute, fact[4].comment. I can programmatically tack on this attribute
without altering the data structure for all the other facts. The structure is
data-centric, not category-centric.
This allows incredible flexibility. I do not need to know which elements a
fact[x] has; I can determine them on the fly and react accordingly (or add
them on the fly). I use this same technique in my cartHandle Applescript CGI
shopping cart system. I do not need to know every attribute (aka name/value
pair) of an item to use the data correctly.
It appears that XML was designed to allow this sort of usage.
</wax>
Unfortunately, with XML tools, it seems you must know the exact structure of
every attribute list for every tag in order to use the information. This is
basically the same old problem of Applescript records. Given record
{color:"red", size:"2 ft.", price:"9.95"}, there is no easy way to produce
the list {"color", "size", "price"}. There are hard, slow, klunky ways, but
who wants them?
This deficit means that, as written, XML tools is only useful for small,
limited, inflexible uses. If the data structure is changed, the programming
*must* be changed too. Currently, I don't need to do that with my homegrown
data structures.
Where am I confused here? I really want to be able to begin using XML tools
because of XML's promise of interplatform interoperability, but not at the
expense of functionality and flexibility.
Maybe the solution is to not use Applescript records for attributes. Thus,
the product of XML tools would look like this:
{
class:XML document,
XML tag:"start",
XML contents:{
"some text",
{
class:XML element,
XML tag:"tag",
XML attributes:{
{"attribute1","value1"},
{"attribute2","value2"}
}
}
"some more text",
{
class:XML element,
XML tag:"tag",
XML attributes:{
{"attribute1","value3"},
{"attribute2","value4"}
}
}
}
}
Would that be hard to do? Maybe even offer the choice via the XML tools
dictionary, eg.
parse XML Unicode text
[with attribute format DATA STRUCTURE] -- "paired list", "record"
Thus, you could generate (record)
{attribute1:"value1", attribute2:"value2"}
or (paired list)
{{"attribute1","value1"},{"attribute2","value2"}}
If this could be done, I would be very (very, very) excited about XML tools.
Thanks for any thoughts!
Of course, the real fix is for the Applescript team to implement more robust
records with built in data type conversion between paired lists and records
(but then backwards compatibility becomes an issue).
Jeff Baumann
email@hidden
www.linkedresources.com
In a message dated 11/20/01 4:13:32 PM, Mark Alldritt wrote:
>
Hello,
>
>
Version 2.3.2 of XML Tools has been released. This version allows
>
whitespace to appear before the initial <?xml ... ?> element and the
>
generate XML command correctly emits whitespace between attributes with
>
pretty printing is disabled.
>
>
XML Tools is a general purpose XML parser and generator for AppleScript that
>
runs on Mac OS 8.6-9.2.1 and Mac OS X 10.0 and later.
>
>
http://www.latenightsw.com/freeware/XMLTools2/index.html
>
>
Along with XML Tools 2.3.2, we have released version 1.0d8 of our XML-RPC
>
library for Classic MacOS systems. This version is compatible with the
>
www.osaxen.com XML-RPC services.
>
>
http://www.latenightsw.com/freeware/XMLTools2/xml-rpc.html
>
>
Cheers
>
-Mark