REXML: Got stuck

Hi Rubyaner ! :slight_smile:

I want to reorder my bookmarks, a xbel document generated by KDE's
Konqueror 3.3. with ruby (what else? :wink:

The elements are known but they can include each other in a
unpredictable order: A <folder>...</folder> can include
<bookmark>...</bookmark> 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" :wink:

Thank you very much for any help or hint in advance !

Ruby.use!
Meino

Meino Christian Cramer wrote:

Hi Rubyaner ! :slight_smile:

I want to reorder my bookmarks, a xbel document generated by KDE's
Konqueror 3.3. with ruby (what else? :wink:

The elements are known but they can include each other in a
unpredictable order: A <folder>...</folder> can include
<bookmark>...</bookmark> 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" :wink:

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 :frowning: )

Hope that helps!

Henrik

Meino Christian Cramer wrote:

> Hi Rubyaner ! :slight_smile:
>
> I want to reorder my bookmarks, a xbel document generated by KDE's
> Konqueror 3.3. with ruby (what else? :wink:
>
> The elements are known but they can include each other in a
> unpredictable order: A <folder>...</folder> can include
> <bookmark>...</bookmark> 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" :wink:
>
> 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 :frowning: )

Hope that helps!

Henrik

Hi Henrik,

..short question: Since I dont know the solution of my problem, I
also dont know, of what "parts" it consists. So my question is: What
should I feed into Google: "Martin Fowler" and "XSLT"...sonds not
very sufficient...

Please give me a hint...thanks a lot in advance and sorry for getting
stuck again... :slight_smile:

Ruby.use!
Meino

路路路

From: Henrik Horneber <ryco@gmx.net>
Subject: Re: REXML: Got stuck...
Date: Fri, 10 Sep 2004 20:45:15 +0900

Meino Christian Cramer wrote:

..short question: Since I dont know the solution of my problem, I
also dont know, of what "parts" it consists. So my question is: What
should I feed into Google: "Martin Fowler" and "XSLT"...sonds not
very sufficient...

Please give me a hint...thanks a lot in advance and sorry for getting
stuck again... :slight_smile:

James

Hi James,

*THANK YOU* !

:slight_smile:

Meino

路路路

From: James Britt <jamesUNDERBARb@neurogami.com>
Subject: Re: REXML: Got stuck...
Date: Sat, 11 Sep 2004 02:46:40 +0900

Meino Christian Cramer wrote:
> ..short question: Since I dont know the solution of my problem, I
> also dont know, of what "parts" it consists. So my question is: What
> should I feed into Google: "Martin Fowler" and "XSLT"...sonds not
> very sufficient...
>
> Please give me a hint...thanks a lot in advance and sorry for getting
> stuck again... :slight_smile:

Moving Away From Xslt

James

Meino Christian Cramer wrote:

..short question: Since I dont know the solution of my problem, I
also dont know, of what "parts" it consists. So my question is: What
should I feed into Google: "Martin Fowler" and "XSLT"...sonds not
very sufficient...

Please give me a hint...thanks a lot in advance and sorry for getting
stuck again... :slight_smile:

Hi!

When I reread my message a second ago, I realized it is not the kind of answer I would like to receive. Not exactly helpful. :confused:

Sorry!

And thanks James for clearing that up.

Henrik

Hi Henrik,

>>Meino Christian Cramer wrote:
>>
>>> ..short question: Since I dont know the solution of my problem, I
>>> also dont know, of what "parts" it consists. So my question is: What
>>> should I feed into Google: "Martin Fowler" and "XSLT"...sonds not
>>> very sufficient...
>>>
>>> Please give me a hint...thanks a lot in advance and sorry for getting
>>> stuck again... :slight_smile:

Hi!

When I reread my message a second ago, I realized it is not the kind of
answer I would like to receive. Not exactly helpful. :confused:

Sorry!

  No problem at all ! No need to feel sorry! :slight_smile:

And thanks James for clearing that up.

Henrik

Ruby.use!
Meino

路路路

From: Henrik Horneber <ryco@gmx.net>
Subject: Re: REXML: Got stuck...
Date: Sat, 11 Sep 2004 04:13:26 +0900