---
layout: post
title: Libxml - Introduction
---

## Welcome to LibXml Ruby
The <span style="color: red;">Libxml-Ruby</span> project provides Ruby
language bindings for the <a href="http://xmlsoft.org">GNOME Libxml2 XML toolkit</a>.
It is free software, released under the <a href="license.xml">MIT License</a>.

Libxml-ruby's primary advantage over REXML is performance - if speed is your need,
these are good libraries to consider, as demonstrated by the informal benchmark below.

<table border="1" style="border: 1px solid red; margin: 30px;">
    <tr><td colspan="3"><b>Speed Comparison libxml vs. rexml</b></td></tr>
    <tr><th> in seconds    </th><th> libxml   </th><th> rexml    </th></tr>
    <tr><td> opening       </td><td> 0.003954 </td><td> 0.104750 </td></tr>
    <tr><td> attribute_add </td><td> 0.001895 </td><td> 0.011114 </td></tr>
    <tr><td> subelems      </td><td> 0.000585 </td><td> 0.004729 </td></tr>
    <tr><td> xpath         </td><td> 0.013269 </td><td> 2.981499 </td></tr>
</table>


## Installation
Installation is very simple - just issue the appropriate command, e.g:

      gem install -r libxml-ruby

Note that depending on your setup you may need to run this as root:

      su -c 'gem install -r libxml-ruby'

During installation Gems should build and install the extension to the correct location.

## Windows Support
libxml-ruby comes with prebuilt Windows binaries for both Ruby 1.8 and 1.9.


## Prerequisites
libxml requires a few other libraries to be installed in order to build and function properly.

	  * libm      (math routines: very standard)
	  * libz      (zlib)
	  * libiconv
	  * libxml2
	