Re: system events XML suite -- it seems to be caching and holding XML objects
Re: system events XML suite -- it seems to be caching and holding XML objects
- Subject: Re: system events XML suite -- it seems to be caching and holding XML objects
- From: has <email@hidden>
- Date: Fri, 14 Oct 2005 00:13:18 +0100
Steven D. Majewski wrote:
>So it appears that once System Events creates a named XML data object,
>it holds on to it.
Of course it does; that's how the Apple Event Object Model works. Once created, elements persist until deleted.
>But can anyone please explain what's going on ?
Can't be bothered to reboot into Tiger to verify this, but I'd guess that when you make a new named XML data element, the make command returns a by-name reference to it, and when you make an unnamed XML data element it returns a by-index reference. That would explain the difference you see when creating named vs unnamed XML data elements.
Also, like most scriptable apps, it's perfectly legal to have multiple sibling elements with the same name. Note that the by-name reference form is actually the same as saying 'first <element> whose name = <whatever>'. Since new elements are created after existing ones, if you already have an element named "foo" and make a new one with the same name, a reference to 'item "foo"' will always return the first one. (Only the by-ID reference form is guaranteed always to refer to the same object.)
Anyway, I'd recommend you monitor the event log, run each line one at a time and observe its return value, and maybe also run 'tell app "System Events" to get every XML data' to see what objects SE is currently holding. It's a lot easier to understand what's going on in a complex script when you break it down and watch what's going on in each line, rather than run it all at once and try to figure out what's going on from the final result alone. Nothing like a bit of study and experimentation to make sense of things.
HTH
has
--
http://freespace.virgin.net/hamish.sanderson/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden