Re: ANNOUNCE: XML Tools 2.3.2
Re: ANNOUNCE: XML Tools 2.3.2
- Subject: Re: ANNOUNCE: XML Tools 2.3.2
- From: has <email@hidden>
- Date: Mon, 26 Nov 2001 00:56:58 +0000
Jeff Baumann wrote:
>
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?
...
>
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).
Doing conversions between paired lists and records would be a good addition
to XML Tools, considering the current nature of AS (i.e. the weakness is
AS's).
For the 'real fix', I'd much prefer Apple to add something that'd allow you
to access/manipulate records as if they were hash arrays. With paired
lists, you have to use loops to dig out your data, which is slow and ugly.
(True hashes are another possibility, but I think sticking with an
established data structure and adding more tools to manipulate it would be
more flexible and convenient for users.)
e.g. The HashLib mod I did recently lets you do this, e.g.
set a to {x:1, y:2}
getRecordValue(a, "x")
This would be equivalent to saying 'get "x" of a' (exactly what I'd like to
see in AS, btw; even a 3rd-party osax would do).
As for backwards compatibility, this will always be an issue for any new
feature. All I can say is the sooner we get it, the sooner we can start
using it. So here's hoping...
has