Class: Placemaker::XmlParser
- Inherits:
-
Object
- Object
- Placemaker::XmlParser
- Defined in:
- lib/placemaker/xml_parser.rb
Instance Method Summary collapse
-
#document_length ⇒ Object
length in bytes of the document.
-
#documents ⇒ Object
Returns a set of Placemaker::Document objects as containers for content location information.
-
#initialize(xml_body) ⇒ XmlParser
constructor
A new instance of XmlParser.
-
#processing_time ⇒ Object
time in seconds to process the document.
-
#version ⇒ Object
version of the software used to process the document.
Constructor Details
#initialize(xml_body) ⇒ XmlParser
Returns a new instance of XmlParser.
5 6 7 |
# File 'lib/placemaker/xml_parser.rb', line 5 def initialize(xml_body) @xml = Nokogiri::XML(xml_body) end |
Instance Method Details
#document_length ⇒ Object
length in bytes of the document
20 21 22 |
# File 'lib/placemaker/xml_parser.rb', line 20 def document_length @xml.xpath('.//xmlns:documentLength').inner_text.to_i end |
#documents ⇒ Object
Returns a set of Placemaker::Document objects as containers for content location information
25 26 27 28 29 |
# File 'lib/placemaker/xml_parser.rb', line 25 def documents @xml.xpath('//xmlns:document', 'xmlns' => 'http://wherein.yahooapis.com/v1/schema').map do |d| Placemaker::Document.new(d) end end |
#processing_time ⇒ Object
time in seconds to process the document
10 11 12 |
# File 'lib/placemaker/xml_parser.rb', line 10 def processing_time @xml.xpath('.//xmlns:processingTime').inner_text.to_f end |
#version ⇒ Object
version of the software used to process the document
15 16 17 |
# File 'lib/placemaker/xml_parser.rb', line 15 def version @xml.xpath('.//xmlns:version').inner_text.strip end |