Sha256: f1f10e2b15c75da6e4b9a61c7cf10d255bd62d32c361f8a1be0186d99eae2856
Contents?: true
Size: 892 Bytes
Versions: 1
Compression:
Stored size: 892 Bytes
Contents
module Awis module Utils class XML def initialize(data) @data = data end def each_node(attributes_in_path = false) reader = Nokogiri::XML::Reader(@data) nodes = [''] reader.each do |node| if node.node_type == Nokogiri::XML::Reader::TYPE_ELEMENT if attributes_in_path && node.attributes.size > 0 attributes = [] node.attributes.sort.each do |name, value| attributes << "@#{name}=#{value}" end nodes << "#{node.name}/#{attributes.join('/')}" else nodes << node.name end path = nodes.join('/') yield node, path end nodes.pop if node.node_type == Nokogiri::XML::Reader::TYPE_END_ELEMENT || node.self_closing? # End tag end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
awis-sdk-ruby-1.0.0 | lib/awis/utils/xml.rb |