module XmlUtil

Public Class Methods

child_attribute(node, elementname, attributename) click to toggle source
# File lib/abelard/postxml.rb, line 8
def self.child_attribute(node, elementname, attributename)
  el = node.children.find { |n| n.name == elementname }
  attr = el && el.attributes.get_attribute("term")
  attr && attr.value
end
child_content(node, elementname) click to toggle source
# File lib/abelard/postxml.rb, line 4
def self.child_content(node, elementname)
  el = node.children.find { |n| n.name == elementname }
  el && el.content
end
with_attribute(node, attributename, attributevalue) click to toggle source
# File lib/abelard/postxml.rb, line 13
def self.with_attribute(node, attributename, attributevalue)
  a = node.attributes.get_attribute(attributename)
  a && (a.value == attributevalue)
end