REXML is an XML parser for Ruby, in Ruby.

Repository: Author: Sean Russell <>


REXML is an XML 1.0 compliant, reasonably fast, non-validating XML parser. It has an API that is designed to be intuitive, straightforward. and terse. REXML includes a tree model parser, a SAX2 streaming parser, and a pull parser. It also includes a full XPath implementation. All of REXML’s parsers pass 100% of the Oasis XML non-validating tests.

Why did I write REXML? At the time of this writing, there were already two XML parsers for Ruby. The first is a Ruby binding to a native XML parser. This is a fast parser, using proven technology. However, it isn’t very portable. The second is a native Ruby implementation, but I didn’t like its API very much. Neither of these provide all three parsers, and neither provide XPath implementations. However, I primarily wrote REXML so that I could have access to an API that doesn’t contain a lot of cruft, and is intuitive.

This is the third major iteration of REXML.


REXML was adopted into the core Ruby library, and is not actively maintained as a separate project. As a pure Ruby library, it has the advantage of being fully cross-platform; however, it also suffers from a dependency on Ruby hash maps, which encounter memory issues when they get large, and it is not as fast as native libraries can be. For small projects, it is simple and convenient. For large production systems, a native library may be more appropriate.