class Mechanize::XmlFile

This class encapsulates an XML file. If Mechanize finds a content-type of 'text/xml' or 'application/xml' this class will be instantiated and returned. This class also opens up the search and at methods available on the underlying Nokogiri::XML::Document object.


require 'mechanize'

agent =
xml = agent.get('')
xml.class #=> Mechanize::XmlFile'//foo[@attr="bar"]/etc')



The underlying Nokogiri::XML::Document object

Public Class Methods

new(uri = nil, response = nil, body = nil, code = nil) click to toggle source
Calls superclass method
# File lib/mechanize/xml_file.rb, line 23
def initialize(uri = nil, response = nil, body = nil, code = nil)
  super uri, response, body, code
  @xml = Nokogiri.XML body

Public Instance Methods

at() click to toggle source

Search through the page for path under namespace using Nokogiri's at. The path may be either a CSS or XPath expression.

See also Nokogiri::XML::Node#at

# File lib/mechanize/xml_file.rb, line 46
def_delegator :xml, :at, :at