Skip to content


222 4 22 NA
4.2.0 (9 Sep 2021) Aug 05 2009 61.4 thousand (month)

ROXML is a Ruby gem that provides a simple and intuitive way to map XML documents to Ruby objects, and vice versa. It provides a simple and intuitive API for defining the mapping between the XML and the Ruby object, and it uses Nokogiri to parse and search the XML documents.

One of the main features of ROXML is its ability to map elements and attributes of an XML document to properties of a Ruby object, and vice versa. It allows you to define the mapping between the elements or attributes and the properties using a simple and intuitive API, and then automatically applies the mapping to the document, creating an instance of the Ruby object with the properties set to the values from the XML document. It also provides a way to map a Ruby object to an XML document.

ROXML also provides a variety of other features that can simplify the process of working with XML documents. It can handle nested elements, it can handle arrays of elements, and it can handle different data types. It also provides a built-in support for parsing XML using Nokogiri.

ROXML is also known to be more flexible and powerful than other libraries like HappyMapper because it also allows to map a Ruby object to an XML document and it's more flexible when it comes to handling of arrays, and nested elements.

Example Use

require 'roxml'

class Book
  include ROXML
  xml_name :book
  xml_accessor :title, :from => '@title'
  xml_accessor :author, :from => 'author'

xml_string = '<book title="The Great Gatsby">
                 <author>F. Scott Fitzgerald</author>

book = Book.from_xml(xml_string)
puts book.title # "The Great Gatsby"
puts # "F. Scott Fitzgerald"

Alternatives / Similar

893 2.14.18 (a month ago) Jul 01 2011 compare
153 0.10.0 (4 months ago) Mar 19 2010 compare

Other Languages