Sha256: b1294ce1c7f400120d8e4cdc6d6d4a93c46c4558ec99cf7bf069b9f5400bcbf9
Contents?: true
Size: 872 Bytes
Versions: 123
Compression:
Stored size: 872 Bytes
Contents
#!/usr/bin/ruby require 'xml/smart' Dir['*.xml'].each do |f| XML::Smart.modify(f) do |doc| p f doc.register_namespace 'd', 'http://cpee.org/ns/description/1.0' doc.register_namespace 'p', 'http://riddl.org/ns/common-patterns/properties/1.0' if doc.root.qname.name == 'testset' doc.find('//d:call').each do |e| x = e.find('d:finalize') if x.length > 0 code = x.first.add_before 'code' code.add x code.add e.find('d:update') end x = e.find('d:_timing') if x.length > 0 code = x.first.add_before 'annotations' code.add x code.add e.find('d:_notes') end end begin if doc.find('//attributes/p:theme').any? doc.find('//attributes/p:theme').first.text = 'preset' end rescue end end end end
Version data entries
123 entries across 110 versions & 1 rubygems