#Created by Ben Hall - Blog.BenHall.me.uk require 'mscorlib' require 'System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' include System require 'System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' include System::Xml #Wrapper around .Net XMLDocument to make it easier to query with - more like REXML class Document def initialize(xml) @document = XmlDocument.new @document.load_xml xml end def elements(xpath, &b) ele = @document.select_nodes xpath ele.each do |e| b.call e end end end #Monkey patch XmlElement object within System::Xml class XmlElement def get(name) select_single_node name end def node(xpath, &b) ele = select_nodes xpath ele.each do |e| b.call e end end def to_s text end def text inner_text.to_s #cast to a IronRuby.Bultins.MutableString end end