And after this, the text that is repeated for each episode is of this format:
I referred some posts in this forum and began scripting:
set XMLfile to ((path to desktop as text) & "ontheeconomy.xml")
tell application "System Events"
tell contents of XML file XMLfile
tell XML element 1
set Episodelist to value of XML element "title"
end tell
end tell
end tell
and i got the error:
I also tried using XML element “channel” instead of “1”.
set XMLfile to ((path to desktop as text) & "ontheeconomy.xml")
tell application "System Events"
tell contents of XML file XMLfile
tell XML element 1 -- <rss>
set Episodelist to value of XML element "title" of XML element 1 -- <channel>
end tell
end tell
end tell
Thanks, StefanK.
I could extract the link and title for the first episode.
set XMLfile to ((path to desktop as text) & "ontheeconomy.xml")
tell application "System Events"
tell contents of XML file XMLfile
tell XML element 1 -- <rss>
tell XML element 1 -- <channel>
tell XML element "item"
set linklist to {"link: " & value of XML element "link"}
set titlelist to {"title: " & value of XML element "title"}
end tell
end tell
end tell
end tell
end tell
But I am still unable to do it for all the episodes. The element precedes each block of code related to an episode and the element ends such block.
I am sure my answer lies in the script located at http://macscripter.net/viewtopic.php?pid=105042#p105042 but i have failed to use the repeat properly.
which means channel must contain all “item” elements. I have been trying to set up my repeat loop on that assumption for an hour now. It is not working. It fails to go past the first “title” or “link”. Here’s is the xml for your reference: http://www.bloomberg.com/media/podcast/ontheeconomy.xml
set XMLfile to ((path to desktop as text) & "ontheeconomy.xml")
tell application "System Events"
tell contents of XML file XMLfile
tell XML element 1 -- <rss>
set itemElements to XML elements of XML element 1 whose name is "item"
end tell
end tell
set linkList to {}
set titleList to {}
repeat with oneItem in itemElements
set end of titleList to value of XML element "title" of oneItem
set end of linkList to value of XML element "link" of oneItem
end repeat
end tell