class RoyalMailApi::XmlParser
Public Instance Methods
parse(xml, attr)
click to toggle source
# File lib/royal_mail_api/xml_parser.rb, line 3 def parse(xml, attr) unless xml.is_a? Nokogiri::XML::Element xml = Nokogiri::XML(xml).remove_namespaces! end # xpath method doesn't work for finding SOAP Fault attributes for some reason xml.css(attr) end
parse_all(xml, attr)
click to toggle source
# File lib/royal_mail_api/xml_parser.rb, line 12 def parse_all(xml, attr) parse(xml, "//#{attr}") end
parse_text(xml, attr)
click to toggle source
# File lib/royal_mail_api/xml_parser.rb, line 16 def parse_text(xml, attr) parse(xml, attr).text end