Class: SRU::Response

Inherits:
Object
  • Object
show all
Includes:
XPath
Defined in:
lib/sru/response.rb

Overview

base class for all SRU responses

Direct Known Subclasses

ExplainResponse, ScanResponse, SearchResponse, Term

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from XPath

#get_attribute, #xpath, #xpath_all, #xpath_first

Constructor Details

#initialize(doc, parser = 'rexml') ⇒ Response

Returns a new instance of Response.



13
14
15
16
17
18
19
20
21
22
# File 'lib/sru/response.rb', line 13

def initialize(doc, parser = 'rexml')
  @doc = doc
  @parser = parser
  # namespaces for use in xpath queries
  # this is technically more correct and is required for 
  # libxml to be able to parse the explain block.
     @namespaces = {'zs' => 'http://www.loc.gov/zing/srw/',
			'ns0' => 'http://explain.z3950.org/dtd/2.0/'}

end

Instance Attribute Details

#docObject (readonly)

Returns the value of attribute doc.



9
10
11
# File 'lib/sru/response.rb', line 9

def doc
  @doc
end

#namespacesObject (readonly)

Returns the value of attribute namespaces.



11
12
13
# File 'lib/sru/response.rb', line 11

def namespaces
  @namespaces
end

#parserObject (readonly)

Returns the value of attribute parser.



10
11
12
# File 'lib/sru/response.rb', line 10

def parser
  @parser
end