Method: Soaspec::SoapHandler#xpath_elements_for
- Defined in:
- lib/soaspec/exchange_handlers/soap_handler.rb
#xpath_elements_for(response: nil, xpath: nil, attribute: nil) ⇒ Enumerable
Returns the value at the provided xpath
159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/soaspec/exchange_handlers/soap_handler.rb', line 159 def xpath_elements_for(response: nil, xpath: nil, attribute: nil) raise ArgumentError('response and xpath must be passed to method') unless response && xpath xpath = "//*[@#{attribute}]" unless attribute.nil? xpath = '//' + xpath if xpath[0] != '/' temp_doc = response.doc.dup convert_to_lower_case(temp_doc) if convert_to_lower? if strip_namespaces? && !xpath.include?(':') temp_doc.remove_namespaces! temp_doc.xpath(xpath) else temp_doc.xpath(xpath, temp_doc.collect_namespaces) end end |