Re: XML parsing from AppleScript (Kumar Shailove)
Re: XML parsing from AppleScript (Kumar Shailove)
- Subject: Re: XML parsing from AppleScript (Kumar Shailove)
- From: tom wible <email@hidden>
- Date: Tue, 23 Jan 2007 21:15:00 -0500
i'm surprised no one's mentioned tiger's built-in XML parsing...here's the code
i use to parse tivo info files:
try
set tivoFile to POSIX file tivoFile
set tivoFile to tivoFile as Unicode text
tell application "System Events"
set theXML to contents of XML file tivoFile
set tivo to XML element "TvBusMarshalledStruct:TvBusEnvelope" of theXML
set startTime to value of XML element "startTime" of tivo
set stopTime to value of XML element "stopTime" of tivo
set showing to XML element "showing" of tivo
set channel to value of XML element "displayMajorNumber" of ¬
XML element "channel" of showing
set prog to XML element "program" of showing
set progTitle to value of XML element "title" of prog ¬
& " #" & channel as string
set episodeTitle to ""
try -- optional entry
set episodeTitle to value of XML element "episodeTitle" ¬
of prog
end try
set descr to ""
try -- optional entry
set descr to value of XML element "description" of prog
end try
end tell
on error emsg
display alert "parsing tivoXML: " & fileName & return & emsg
end try
_______________________________________________
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/mailman//archives/applescript-users
This email sent to email@hidden