HI all,
Did anybody ever wrote a function to draw a tree (lines for branches, etc.) from the contents of an XML document?
best,
Daniel
Tree builder from XML
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Tree builder from XML
Using livecode 8 you have a widget ready to use: the tree view.
So you can use this code:
########CODE#######
on mouseUp
put URL "http://livecodeitalia.blogspot.com/feeds/posts/default" into tXMLData
put revXMLCreateTree(tXMLData, true, true, true) into sXMLID
set the conID of this card to sXMLID #così recuperiamo il dato
put sXMLID into connID
put "/feed/entry" into curn
put 0 into contatore
repeat while (curn begins with "/feed")
add 1 to contatore
put curn into oldCurn
put revXMLNodeContents(connID, curn & "/title") into myData[contatore]["Title"]
put revXMLNodeContents(connID, curn & "/content") into myData[contatore]["Content"]
put revXMLNodeContents(connID, curn & "/Published") into myData[contatore]["Published"]
put revXMLNextSibling(connID, curn ) into curn
end repeat
set the arrayData of widget "Tree view" to mydata
answer fatto
revXMLDeleteAllTrees
end mouseUp
#####END OF CODE#####
That's all.
Otherwise you can use rTree: http://livecodeitalia.blogspot.it/2015/ ... lbero.html
So you can use this code:
########CODE#######
on mouseUp
put URL "http://livecodeitalia.blogspot.com/feeds/posts/default" into tXMLData
put revXMLCreateTree(tXMLData, true, true, true) into sXMLID
set the conID of this card to sXMLID #così recuperiamo il dato
put sXMLID into connID
put "/feed/entry" into curn
put 0 into contatore
repeat while (curn begins with "/feed")
add 1 to contatore
put curn into oldCurn
put revXMLNodeContents(connID, curn & "/title") into myData[contatore]["Title"]
put revXMLNodeContents(connID, curn & "/content") into myData[contatore]["Content"]
put revXMLNodeContents(connID, curn & "/Published") into myData[contatore]["Published"]
put revXMLNextSibling(connID, curn ) into curn
end repeat
set the arrayData of widget "Tree view" to mydata
answer fatto
revXMLDeleteAllTrees
end mouseUp
#####END OF CODE#####
That's all.
Otherwise you can use rTree: http://livecodeitalia.blogspot.it/2015/ ... lbero.html
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w
Re: Tree builder from XML
Great! In fact this is the first reason I know of to swift to 8.
Thanks a lot
Thanks a lot