• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: xml text to record
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: xml text to record
      • From: Luther Fuller <email@hidden>
References: 
 >xml text to record (From: Luther Fuller <email@hidden>)
 >Re: xml text to record (From: Luther Fuller <email@hidden>)
 >Re: xml text to record (From: Luther Fuller <email@hidden>)
 >Re: xml text to record (From: Axel Luttgens <email@hidden>)

  • Prev by Date: Re: Antw.: Re: Assistance for UI scripting text entry
  • Next by Date: Re: xml text to record
  • Previous by thread: Re: xml text to record
  • Next by thread: Re: xml text to record
  • Index(es):
    • Date
    • Thread