On 17 Oct 2011, at 05:45, Sivakatirswami wrote:
> I am an XML newbie:
>
> if you want to extract data from a series of identical nodes in a XML file,
> how do you set up the repeat function?
>
Here's one way. I'm sure there are others. (It returns a list of names and ages)
Dave
function namesAndAges xml
put revCreateXMLTree(xml,true,true,false) into xmlID
if xmlID is not a number then
returm xmlID -- error string
end if
put revXMLChildNames(xmlID,"/orphanage",comma,"small-child",true) into
tChildren
put empty into tRes
repeat for each item tChild in tChildren
put "/orphanage/" & tChild & "/name" into tNameNode
put "/orphanage/" & tChild & "/age" into tAgeNode
put revXMLNodeContents(xmlID, tNameNode) into tName
put revXMLNodeContents(xmlID, tAgeNode) into tAge
put tName & ", " & tAge & cr after tRes
end repeat
return tRes
end namesAndAges
_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode