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
self_link(node)
click to toggle source
# File lib/abelard/postxml.rb, line 17 def self.self_link(node) el = node.children.find { |l| (l.name == "link") && with_attribute(l, "rel", "self") } el && el.attributes.get_attribute("href").value 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