If you use solr-ruby gem, you should be well aware that Solr attempts to create an XML doc from the provided doc-hash. It first attempts to use 'xml/libxml', which if not available, falls back to REXML. It is recommended to use libxml.
All you need to do is
gem install libxml-rubyIf you are lucky enough, that's all for you. However, many a times we face issues like
Building native extensions. This could take a while... ERROR: Error installing libxml-ruby: ERROR: Failed to build gem native extension. /usr/bin/ruby extconf.rb checking for socket() in -lsocket... no checking for gethostbyname() in -lnsl... yes checking for atan() in -lm... no checking for atan() in -lm... yes checking for inflate() in -lz... no checking for inflate() in -lzlib... no checking for inflate() in -lzlib1... no checking for inflate() in -llibz... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options.If this is the case, you should install zlib-devel and libxml2-devel packages.
yum -y install zlib-devel yum -y install libxml2-devel gem install libxml-ruby
That sorts it all. You are good to go