[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

ruby xml parser opinions?

Andy Koch

4/3/2008 6:56:00 PM

I'm revisiting an app that uses libxml for xml work. Wondering if
anyone has opinions on what is the best available XML parser for Ruby?

REXML seems to get trashed at every opportunity. Hpricot is getting
some good press, but is it better than libxml? Most posts I've seen
when someone chooses hpricot over libxml is because they are running
on Windows.

Found this post "http://yomi.at/archive... which seems recent and
clearly shows libxml as the parser of choice when speed is the primary
consideration.

Any thoughts?

4 Answers

Alex Wayne

4/3/2008 10:16:00 PM

0

Andy Koch wrote:
> I'm revisiting an app that uses libxml for xml work. Wondering if
> anyone has opinions on what is the best available XML parser for Ruby?
>
> REXML seems to get trashed at every opportunity. Hpricot is getting
> some good press, but is it better than libxml? Most posts I've seen
> when someone chooses hpricot over libxml is because they are running
> on Windows.
>
> Found this post "http://yomi.at/archive... which seems recent and
> clearly shows libxml as the parser of choice when speed is the primary
> consideration.
>
> Any thoughts?

Hpricot is awesome, but if I need to have anything that parses
namespaces, I use REXML. I don't like REXML at all, but it handles
namespaces well enough. Hpricot is so easy to use you have ever used
CSS that its hard not to recommend.
--
Posted via http://www.ruby-....

ara.t.howard

4/4/2008 12:46:00 AM

0


On Apr 3, 2008, at 1:00 PM, Andy Koch wrote:
> 'm revisiting an app that uses libxml for xml work. Wondering if
> anyone has opinions on what is the best available XML parser for Ruby?
>
> REXML seems to get trashed at every opportunity. Hpricot is getting
> some good press, but is it better than libxml? Most posts I've seen
> when someone chooses hpricot over libxml is because they are running
> on Windows.
>
> Found this post "http://yomi.at/archive... which seems recent and
> clearly shows libxml as the parser of choice when speed is the primary
> consideration.
>
> Any thoughts?
>


depends entirely on your use case

- skimming a small amount of data from nested nodes -> hpricot

- parsing a hierarchy where attrs and relationship of parent <-> child
is important -> rexml


a @ http://codeforp...
--
we can deny everything, except that we have the possibility of being
better. simply reflect on that.
h.h. the 14th dalai lama




Phlip

4/4/2008 12:57:00 AM

0

ara.t.howard wrote:

> depends entirely on your use case
>
> - skimming a small amount of data from nested nodes -> hpricot
>
> - parsing a hierarchy where attrs and relationship of parent <-> child
> is important -> rexml

- parsing to the exact DTD of HTML, while forgiving small inconvences,
rapidly, with good xpath support -> libxml

--
Phlip
http://assertxpath.ruby...

Robert Klemme

4/4/2008 9:40:00 AM

0

2008/4/3, Andy Koch <public@no-ego.net>:
> I'm revisiting an app that uses libxml for xml work. Wondering if
> anyone has opinions on what is the best available XML parser for Ruby?
>
> REXML seems to get trashed at every opportunity.

It may seem so. But keep in mind that if something does not work as
expected people will shout loudly - while all those that are satisfied
are usually quietly enjoying it. Whenever I have to do XML in Ruby I
use REXML. Granted, I don't have large files to handle right now but
if, I would try using REXML's stream parser instead of doing anything
else.

> Found this post "http://yomi.at/archive... which seems recent and
> clearly shows libxml as the parser of choice when speed is the primary
> consideration.

Probably true, but with the stream based approach you can also get
more out of REXML. I like the fact that it does not require a binary
extension and is part of the standard install. Ultimate speed for me
is not as important as availability and portability of my scripts.

YMMV

Kind regards

robert

--
use.inject do |as, often| as.you_can - without end