Module: BrInvoicesPdf::Util::XmlLocate
- Included in:
- Cfe::Parser::AccessKey, Cfe::Parser::Cnpj, Cfe::Parser::CompanyAttributes, Cfe::Parser::Cpf, Cfe::Parser::DocumentNumber, Cfe::Parser::FiscoObs, Cfe::Parser::Payment, Cfe::Parser::Payments, Cfe::Parser::ProductsData, Cfe::Parser::Sat, Nfce::Parser::AdditionalInfo, Nfce::Parser::Company, Nfce::Parser::Customer, Nfce::Parser::EmissionDetails, Nfce::Parser::Payments, Nfce::Parser::Products, Nfce::Parser::Totals
- Defined in:
- lib/br_invoices_pdf/util/xml_locate.rb
Class Method Summary collapse
Class Method Details
.locate_element(xml, path) ⇒ Object
8 9 10 11 |
# File 'lib/br_invoices_pdf/util/xml_locate.rb', line 8 def locate_element(xml, path) element = xml.locate(path).first element.text if element.is_a?(Ox::Element) end |
.node_locate(element, path) ⇒ Object
17 18 19 20 |
# File 'lib/br_invoices_pdf/util/xml_locate.rb', line 17 def node_locate(element, path) value = element.nodes.first.locate(path).first value.text if value.is_a?(Ox::Element) end |
.root_path(xml) ⇒ Object
13 14 15 |
# File 'lib/br_invoices_pdf/util/xml_locate.rb', line 13 def root_path(xml) xml.name == 'NFe' ? 'infNFe' : 'NFe/infNFe' end |