Fastest SAX-style XML parsers for JRuby
I need to port some simple Ruby program to Windows, and I thought I'd use JRuby to avoid most of the hassle, but there's no libxml for JRuby.
What should I use instead? I have gigaby开发者_JAVA技巧tes of XML to process, so I'd prefer if it was fast.
There is libxml-jruby. It aims to be an API compatible replacement for libxml-ruby and drops into ruby code seamlessly if you have it installed within JRuby. However, I have found it to be lacking in certain areas (XPath and error handling) and I can't vouch for its SAX coverage.
Another option for JRuby would be Nokogiri - you'll have to search for it as I can only post one hyperlink! It has a JRuby component to it but, although I've heard good things about it, I've not had time to try it yet.
Any pure ruby XML library will work in JRuby of course, but if you have gigabytes of data to process you might want to stay clear of those, speed wise.
精彩评论