Sha256: caa452d4c6332c9b420f2c2f7db9b418d94649eeb46684beef9971e080547b1d
Contents?: true
Size: 818 Bytes
Versions: 7
Compression:
Stored size: 818 Bytes
Contents
require 'nokogiri' class Nokogiri::XML::Node ## # Language, taken recursively from element and ancestors def language @lang ||= attribute('lang') || attributes["lang"] || attributes["xml:lang"] || (parent && parent.element? && parent.language) end ## # Get any xml:base in effect for this element def base if @base.nil? @base = attributes['xml:base'] || (parent && parent.element? && parent.base) || false end @base == false ? nil : @base end def display_path @display_path ||= case self when Nokogiri::XML::Document then "" when Nokogiri::XML::Element then parent ? "#{parent.display_path}/#{name}" : name when Nokogiri::XML::Attr then "#{parent.display_path}@#{name}" end end end class Nokogiri::XML::Document end
Version data entries
7 entries across 7 versions & 1 rubygems