Re: Problem parsing XML from a SOAP call
Re: Problem parsing XML from a SOAP call
- Subject: Re: Problem parsing XML from a SOAP call
- From: has <email@hidden>
- Date: Thu, 21 Feb 2002 13:15:08 +0000
steve harley wrote:
>
but if you don't know the names of properties in advance, you'll
>
have to refer to the archives on some awkward workarounds
>
(with which i'm not intimately familiar).
The RecordAccess osax can get property names for you, but it's not OS
X-savvy. A pretty heinous alternative is to use my old hashLib library (see
ScriptBuilders at macscripter.net) which has a thoroughly evil - though
serviceable - getRecordLabels() handler. However, I'd recommend using a
more "AS-friendly" method of converting your XML - if you can. Late Night
Software's XML Tools keeps everything very generic and list-based (the
tradeoff being that accessing data in this form is much more tedious; lots
of repeat loops and "dumb" hunt-the-value code, but it's the most you can
hope for under the circumstances).
BTW, if you were really crazy, it wouldn't be impossible to write an XML
parser in AS that would put data into a structure that would be flexible,
convenient and easily accessible. [I've already written a slightly
specialised HTML parser that could be reworked to do regular XML parsing.]
Not the most fun way to spend time I can think of, but could be done.
>
it does seem that you are getting data which could be better
>
structured
The structure seems pretty logical in itself: it's AS's longstanding and
very frustrating lack of hash arrays that's the real problem. No doubt
it'll happen eventually, but meantime I suspect this sort of complaint is
only going to get more common.
>
is this the kind of thing SOAP always returns? is it
>
a symptom of how AppleScript handles XML? or is it just how Manilla
>
is set up?
i.e. Who's to blame for implementing a system that's entirely logical - yet
completely fails to take into account how AS actually works? ;p
>
i think it would be easier to work with if anything
>
not predetermined were a value within each record, such as:
>
>
{department:"america", pictureshortcut:"topicAmerica"}
Very hard to get there from here, since the XML parser isn't likely to know
which labels are predetermined and which aren't. Not that dealing with
semantics is its job anyway. (BTW, in the original post, I didn't much like
the look of those parsed <createddate> elements - what are those hideous,
inaccessible-looking data objects meant to be?)
Maybe all the XML users should start lobbying the AS team to prioritise
hash support on their "To Do" list? Might help... they're obviously serious
about XML, so adding AS language features that'll let folk work properly
with parsed data should be a logical next step.
Cheers,
has
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.