Class: Mechanize::XmlFile

### Home Classes Methods

### In Files

- lib/mechanize/xml_file.rb

### Parent

Mechanize::File

### Methods

- ::new
- #at
- #search

### Files

- EXAMPLES.rdoc
- GUIDE.rdoc
- LICENSE.rdoc
- Manifest.txt
- README.rdoc

### Class/Module Index

Quicksearch

- Mechanize
- Mechanize::ChunkedTerminationError
- Mechanize::ContentTypeError
- Mechanize::Cookie
- Mechanize::CookieCMethods
- Mechanize::CookieDeprecated
- Mechanize::CookieIMethods
- Mechanize::CookieJar
- Mechanize::CookieJarIMethods
- Mechanize::DirectorySaver
- Mechanize::Download
- Mechanize::ElementMatcher
- Mechanize::Error
- Mechanize::File
- Mechanize::FileConnection
- Mechanize::FileRequest
- Mechanize::FileResponse
- Mechanize::FileSaver
- Mechanize::Form
- Mechanize::Form::Button
- Mechanize::Form::CheckBox
- Mechanize::Form::Field
- Mechanize::Form::FileUpload
- Mechanize::Form::Hidden
- Mechanize::Form::ImageButton
- Mechanize::Form::Keygen
- Mechanize::Form::MultiSelectList
- Mechanize::Form::Option
- Mechanize::Form::RadioButton
- Mechanize::Form::Reset
- Mechanize::Form::SelectList
- Mechanize::Form::Submit
- Mechanize::Form::Text
- Mechanize::Form::Textarea
- Mechanize::HTTP
- Mechanize::HTTP::Agent
- Mechanize::HTTP::AuthChallenge
- Mechanize::HTTP::AuthRealm
- Mechanize::HTTP::AuthStore
- Mechanize::HTTP::ContentDispositionParser
- Mechanize::HTTP::WWWAuthenticateParser
- Mechanize::Headers
- Mechanize::History
- Mechanize::Image
- Mechanize::Page
- Mechanize::Page::Base
- Mechanize::Page::Frame
- Mechanize::Page::Image
- Mechanize::Page::Label
- Mechanize::Page::Link
- Mechanize::Page::MetaRefresh
- Mechanize::Parser
- Mechanize::PluggableParser
- Mechanize::Prependable
- Mechanize::RedirectLimitReachedError
- Mechanize::RedirectNotGetOrHeadError
- Mechanize::ResponseCodeError
- Mechanize::ResponseReadError
- Mechanize::RobotsDisallowedError
- Mechanize::TestCase
- Mechanize::UnauthorizedError
- Mechanize::UnsupportedSchemeError
- Mechanize::Util
- Mechanize::XmlFile
- HTTP
- HTTP::CookieJar

No matching classes.

# 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.

Example:

    require 'mechanize'

    agent = Mechanize.new
    xml = agent.get('http://example.org/some-xml-file.xml')
    xml.class #=> Mechanize::XmlFile
    xml.search('//foo[@attr="bar"]/etc')

### Attributes

xml[R]

The underlying Nokogiri::XML::Document object

### Public Class Methods

new(uri = nil, response = nil, body = nil, code = nil) click to toggle source

    # 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
    end

### 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

search click to toggle source

Search for `paths` in the page using Nokogiri's search. The `paths` can be XPath or CSS and an optional Hash of namespaces may be appended.

See Nokogiri::XML::Node#search for further details.

    # File lib/mechanize/xml_file.rb, line 36
    def_delegator :xml, :search, :search

[Validate]

Generated with the Darkfish Rdoc Generator 2.