Module: Natsukantou::ParseXml
- Included in:
- UtilityBase
- Defined in:
- lib/natsukantou/utility/parse_xml.rb
Instance Method Summary collapse
Instance Method Details
#dom(xml) ⇒ Oga::XML::Document
7 8 9 10 11 12 13 |
# File 'lib/natsukantou/utility/parse_xml.rb', line 7 def dom(xml) Oga.parse_xml(xml, strict: true) rescue => e logger.error(e.) Oga.parse_xml(xml) end |
#dom_node(xml) ⇒ Oga::XML::Node
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/natsukantou/utility/parse_xml.rb', line 17 def dom_node(xml) dom = dom(xml) if dom.children.size != 1 logger.error("Parsed XML contains more than one root element:") logger.error(xml) end dom.children.first end |