XML Question
David Bovill
david at openpartnership.net
Fri Aug 29 06:51:09 EDT 2008
Below is the parsing script. All the tags from the feedML end up in the
arrays. Only the tags with name spaces (ie colons in their names are failing
to be found).
on mouseUp
put "http://feeds.delicious.com/v2/rss/fortyfoxes/RunRev" into feedXML
delicious_ParseTaggedUserBookmarks feedXml, metaArray, feedArray,
tagArray
end mouseUp
on delicious_ParseTaggedUserBookmarks feedXml, @metaArray, @feedArray,
@tagArray
put revCreateXMLTree(feedXml, true, true, false) into treeID
set the itemdelimiter to "/"
put "rss/channel" into startNode
repeat for each item feedTag in "title/link/description/atom:link"
put startNode & "/" & feedTag into metaNode
get revXMLNodeContents(treeID, metaNode)
put it into metaArray [feedTag]
end repeat
put revXMLNumberOfChildren(treeID, startNode, "item", 1) into
maxItemNodes
repeat with itemNum = 1 to maxItemNodes
put "rss/channel/item[" & itemNum & "]" into itemNode
put revXMLNodeContents(treeID, (itemNode & "/guid")) into idUrl
put item -1 of idUrl into hashID
repeat for each item tagName in
"title/pubDate/link/dc:creator/comments/wfm:commentRss/source"
breakpoint
put itemNode & "/" & tagName into itemChildNode
put revXMLNodeContents(treeID, itemChildNode) into itemValue
put itemValue into itemArray [tagName]
end repeat
put empty into someTags
put revXMLNumberOfChildren(treeID, itemNode, "category", 1) into
maxCatNodes
repeat with catNum = 1 to maxCatNodes
put itemNode & "/category[" & catNum & "]/" into catNode
put word 1 to -1 of revXMLNodeContents(treeID, catNode) into
someTag
put text_Utf8Decode(someTag) & comma after someTags
end repeat
delete char -1 of someTags
put someTags into itemArray ["tagList"]
replace comma with CR in someTags
put someTags into tagArray [hashID]
combine itemArray with CR and tab
put itemArray into feedArray [hashID]
end repeat
revDeleteXMLTree treeID
return feedArray
end delicious_ParseTaggedUserBookmarks
More information about the use-livecode
mailing list