Read XML

Is there a possibility to read xml files in Applescript/Xcode (not to read line by line)?

Try XML Tools by Late Night Software. Best of all, it’s free.

http://www.latenightsw.com/freeware/XMLTools2/index.html

Malcom

Also XMLLib osax 2.0 from Satimage. Very good, and also free.

http://www.satimage.fr/software/en/downloads_osaxen.html

You can also use a shell script if it’s on your computer

set the_XML to do shell script "cat ~/path/to/xmlfile.xml"

or curl…

set the_XML to do shell script "curl [url=http://thewebsite.com/thexml.xml]http://thewebsite.com/thexml.xml"[/url]

It’s useful for Panther .plists…IMO…

If your plist file is basic, you can use the following code. Say your plist file contained the following content:

Then you could use the following code:

set plist_path to POSIX path of (choose file with prompt "Select a plist file:" without invisibles)
set plist_record to my read_plist(plist_path)
-->{{key_name2:{"1", "2", "3"}, key_name1:"value"}}

on read_plist(plist_path)
	return call method "arrayWithContentsOfFile:" of class "NSArray" with parameter plist_path
end read_plist

Jon