ruby xml parser opinions?

A

Andy Koch

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/archives/19" which seems recent and
clearly shows libxml as the parser of choice when speed is the primary
consideration.

Any thoughts?
 
A

Alex Wayne

Andy said:
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/archives/19" 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.
 
A

ara.t.howard

'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/archives/19" 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://codeforpeople.com/
 
R

Robert Klemme

2008/4/3 said:
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/archives/19" 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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top