Last active
March 26, 2019 23:44
-
-
Save privatezero/370e370472f0a6212d0291a76eb1af74 to your computer and use it in GitHub Desktop.
quick and dirty xoai parse for double text types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
doc.xpath("//record/metadata/metadata/element/*[@name='type']/element").each do |line| | |
if line.xpath("field").count > 1 | |
puts line.xpath("field")[2].content | |
end | |
end ; nil | |
# Delete 'text' | |
doc.xpath("//record/metadata/metadata/element/*[@name='type']/element").each do |line| | |
if line.xpath("field").count > 1 | |
line.xpath("field").each do |field| | |
if field.content == 'Text' | |
field.remove | |
end | |
end | |
end | |
end ; nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment