lib/rdf/rdfa/reader/rexml.rb in rdf-rdfa-3.2.2 vs lib/rdf/rdfa/reader/rexml.rb in rdf-rdfa-3.2.3
- old
+ new
@@ -34,13 +34,13 @@
# attribute in no namespace must be ignored for the purposes of determining the element's
# language.
#
# @return [String]
def language
- language = case
- when @node.attribute("lang", RDF::XML.to_s)
- @node.attribute("lang", RDF::XML.to_s)
+ case
+ when @node.attribute("lang", "http://www.w3.org/XML/1998/namespace")
+ @node.attribute("lang", "http://www.w3.org/XML/1998/namespace")
when @node.attribute("xml:lang")
@node.attribute("xml:lang").to_s
when @node.attribute("lang")
@node.attribute("lang").to_s
end
@@ -49,11 +49,11 @@
##
# Return xml:base on element, if defined
#
# @return [String]
def base
- @node.attribute("base", RDF::XML.to_s) || @node.attribute('xml:base')
+ @node.attribute("base", "http://www.w3.org/XML/1998/namespace") || @node.attribute('xml:base')
end
def display_path
@display_path ||= begin
path = []
@@ -222,11 +222,11 @@
# Set xml:base for the document element, if defined
@base_uri = base_uri ? base_uri.to_s : nil
# Only parse as XML, no HTML mode
- doc = ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s)
+ ::REXML::Document.new(input.respond_to?(:read) ? input.read : input.to_s)
end
end
# Determine the host language and/or version from options and the input document
def detect_host_language_version(input, **options)
@@ -329,10 +329,10 @@
case @host_language
when :xhtml1, :xhtml5, :html4, :html5
base_el = ::REXML::XPath.first(@doc, "/html/head/base") rescue nil
base = base.join(base_el.attribute("href").to_s.split("#").first) if base_el
else
- xml_base = root.attribute("base", RDF::XML.to_s) || root.attribute('xml:base') if root
+ xml_base = root.attribute("base", "http://www.w3.org/XML/1998/namespace") || root.attribute('xml:base') if root
base = base.join(xml_base) if xml_base
end
base || @base_uri
end