Project DescriptionA simple wrapper around System.Xml.XmlDocument allowing you to parse Xml documents from IronRuby. Great for use with REST APIs
ExampleThis can also be found on the downloads tab.
# Include the wrapper
require 'xml'
# Create the document
@document = Document.new('<root><name><first>Jim</first><dob><year>1933</year><month>12</month></dob></name><name><first>Bob</first><last>Smith</last></name></root>')
# Access root/name elements
@document.elements('root/name') do |e|
# Output the contents of the element named first
puts e.get('first')
# Access the element named dob, then output the value of year.
e.node('dob') {|y| puts y.get('year')}
end
Created by Ben Hall
|