Re: xml text to record
Re: xml text to record
- Subject: Re: xml text to record
- From: Axel Luttgens <email@hidden>
- Date: Wed, 23 Nov 2011 15:26:16 +0100
Le 23 nov. 2011 à 10:19, Axel Luttgens a écrit :
> [...]
> On the other hand, it seems that the XML Suite of System Events requires a real file as input (didn't remember of that one).
> [...]
Hello Luther,
No wonder that I didn't remember: works perfectly without "real" files...
I must have typed something wrong during my quick trials.
So, for example:
set xmlText to "<?xml version='1.0' encoding='UTF-8'?>
<email id='0123'>
<from>Axel</from>
<to>Luther</to>
<subject>XML matters</subject>
</email>
"
tell application "System Events"
set xmlData to make new XML data with properties {text:xmlText}
value of xml attribute "id" of XML element "email" of xmlData
--> "0123"
name of XML elements of XML element "email" of xmlData
--> {"from", "to", "subject"}
value of XML elements of XML element "email" of xmlData
--> {"Axel", "Luther", "XML matters"}
-- Seems to be needed, since those XML datas tend to persist as application's elements.
-- In case of doubt, execute: delete every XML data
delete xmlData
end tell
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden