Skip to content

Instantly share code, notes, and snippets.

@privatezero
Last active March 26, 2019 23:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save privatezero/370e370472f0a6212d0291a76eb1af74 to your computer and use it in GitHub Desktop.
Save privatezero/370e370472f0a6212d0291a76eb1af74 to your computer and use it in GitHub Desktop.
quick and dirty xoai parse for double text types
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