From: Henrik Horneber Date: 2004-09-10T20:45:15+09:00 Subject: Re: REXML: Got stuck... Meino Christian Cramer wrote: > Hi Rubyaner ! :) > > I want to reorder my bookmarks, a xbel document generated by KDE's > Konqueror 3.3. with ruby (what else? ;) > > The elements are known but they can include each other in a > unpredictable order: A ... can include > ... which can include........and so forth. > > I want to write a loop which steps down the tree one step deeper (and > the way back afterwards) at each looping... > > My problem: I dont know the nesting depth...and I currently have no > idea anymore how to achieve the wanted behaviour. > > My code snippets either prints the very first level element "xbel" > and stops then (probably caused by not able to recurse deeper) or > print the whole bookmarks.xml file at once (only one loop needed > -- also probably caused by not able to recurse) or print nothing. > > Now I get stuck. > > Any ideas? Or is there any xbel-parsing module out there? I asked > ruby forge but it rerturns "nil" ;) > > Thank you very much for any help or hint in advance ! > > Ruby.use! > Meino > > > > > > > > > > > > Hi! This sounds a little bit like what Martin Fowler did with Ruby instead of XSLT. In short, he uses some Visitor-like approach. Google will help you find it (I don't have http here right now :( ) Hope that helps! Henrik