RubyGems.org

XML::Smart - A Ruby class for fast and simple XML access

Copyright (C) 2004-2011 Jürgen Mangler <juergen.mangler@univie.ac.at>

Ruby/XML/Smart is freely distributable according to the terms of the GNU Lesser General Public License (see the file ‘COPYING’).

This program is distributed without any warranty. See the file ‘COPYING’ for details.

Installation

  • You need a least ruby 1.8.7 (1.9 is fine also)

  • You need a least libxml version 1.6.8 (with headers)

  • You need a least libxslt version 1.1.10 (with headers)

Documentation

View the examples in the ./examples subdirectory. In the ./examples/Visualise subdirectory you can find a simple XPath visualiser. Never try to mix this module with other libxml bindings, or you will get nasty segfaults.

SYNOPSIS TO CHANGE A FILE ON THE DISK

require 'xml/smart'

XML::Smart.modify(File.dirname($0) + "/EXAMPLE.xml") { |doc|
  node = doc.find("/test/names").first
  node.add("test_node",{"attr" => 12}, "Muahaha")
  node.add("test_node", "Muahaha", "attr" => 13)
  node.add("test_node", "attr" => 14)
  node.add("test_node", "Muahaha")
  node.add("test_node")
}

SYNOPSIS TO QUERY A FILE

require 'xml/smart'

doc = XML::Smart.open(File.dirname($0) + "/EXAMPLE.xml")

node = doc.find("/test/names").first
puts = node.find("string(name)")
installgem install ruby-xml-smart
Authors

Juergen Mangler

6,975 total downloads 61 for this version
Owners

65754e11f0c4a3ac3a37632107b4b3f3A994fa61b16bbe0c903af8739ac8b175

Gemfile
gem "ruby-xml-smart", "~> 0.2.7"
Versions
  1. 0.2.7 May 20, 2012
  2. 0.2.6 August 13, 2011
  3. 0.2.5.1 August 13, 2011
  4. 0.2.5 August 13, 2011
  5. 0.2.4 February 7, 2011
Show all versions (17 total)