I am trying to parse an xml document using xmllib osax, and loop through the xml. I would like to be able to get the child elements of “Contents” by their name, i.e. like when using XMLXpath theXMLRoot with"". However, I can’t seem to get this to work with children of the root and keep the data organized.
Any help would be greatly appreciated.
Here is the script and xml format.
Thanks
Brad
set thisXMLFile to item i of watchFileList as alias
set thisXMLFileName to name of (get info for thisXMLFile)
set myXML to XMLOpen thisXMLFile
set theXMLRoot to XMLRoot myXML
set myExpiration to XMLGetText (XMLXPath theXMLRoot with "Expiration")
set myExpiration to myExpiration as string
--
set myEmail to XMLGetText (XMLXPath theXMLRoot with "Email")
set myEmail to myEmail as string
--
set mywebservice to XMLGetText (XMLXPath theXMLRoot with "WebService")
set mywebservice to mywebservice as string
--
set mySources to (XMLXPath theXMLRoot with "Contents")
set sourceCount to count of mySources
repeat with i from 1 to sourceCount
--get child elements and their values here
--process these elements before looping to pick up next "Contents" element
end repeat
end repeat
Model: Mac Pro
Browser: Firefox 3.0.6
Operating System: Mac OS X (10.5)