Class: WmsGetcapabilities::Parser
- Inherits:
-
Object
- Object
- WmsGetcapabilities::Parser
- Defined in:
- lib/wms_getcapabilities/parser.rb
Instance Method Summary collapse
- #custom_search(doc, xpath) ⇒ Object
- #get_layers ⇒ Object
-
#initialize(xml) ⇒ Parser
constructor
A new instance of Parser.
- #search(xpath) ⇒ Object
Constructor Details
#initialize(xml) ⇒ Parser
Returns a new instance of Parser.
5 6 7 |
# File 'lib/wms_getcapabilities/parser.rb', line 5 def initialize(xml) @doc = ::Nokogiri::XML(xml) end |
Instance Method Details
#custom_search(doc, xpath) ⇒ Object
13 14 15 |
# File 'lib/wms_getcapabilities/parser.rb', line 13 def custom_search(doc, xpath) doc.xpath(xpath) end |
#get_layers ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/wms_getcapabilities/parser.rb', line 17 def get_layers layers = [] nodes = self.search("//xmlns:Layer[@queryable='1']") nodes.each_with_index do |node, i| unless i==0 l = Layer.from_xml(node) layers << l end end layers end |
#search(xpath) ⇒ Object
9 10 11 |
# File 'lib/wms_getcapabilities/parser.rb', line 9 def search(xpath) @doc.xpath(xpath) end |