Skip to content

Commit

Permalink
Don't define RDF::XML or RDF::XSI, use strings instead.
Browse files Browse the repository at this point in the history
  • Loading branch information
gkellogg committed Jul 23, 2023
1 parent 4827f08 commit 544c502
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Expand Up @@ -36,7 +36,7 @@ jobs:
- name: Run tests
run: ruby --version; bundle exec rspec spec || $ALLOW_FAILURES
- name: Coveralls GitHub Action
uses: coverallsapp/github-action@v1.1.2
uses: coverallsapp/github-action@v2
if: ${{ matrix.ruby == '3.0' && matrix.gemfile == 'Gemfile' }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 4 additions & 4 deletions lib/rdf/rdfa/reader/nokogiri.rb
Expand Up @@ -35,8 +35,8 @@ def initialize(node, parent = nil)
# @return [String]
def language
case
when @node.attribute_with_ns("lang", RDF::XML.to_s)
@node.attribute_with_ns("lang", RDF::XML.to_s)
when @node.attribute_with_ns("lang", "http://www.w3.org/XML/1998/namespace")
@node.attribute_with_ns("lang", "http://www.w3.org/XML/1998/namespace")
when @node.attribute("xml:lang")
@node.attribute("xml:lang").to_s
when @node.attribute("lang")
Expand All @@ -49,7 +49,7 @@ def language
#
# @return [String]
def base
@node.attribute_with_ns("base", RDF::XML.to_s) || @node.attribute('xml:base')
@node.attribute_with_ns("base", "http://www.w3.org/XML/1998/namespace") || @node.attribute('xml:base')
end

def display_path
Expand Down Expand Up @@ -303,7 +303,7 @@ def doc_base(base)
base_el = @doc.at_css("html>head>base")
base = base.join(base_el.attribute("href").to_s.split("#").first) if base_el
else
xml_base = root.attribute_with_ns("base", RDF::XML.to_s) || root.attribute('xml:base') if root
xml_base = root.attribute_with_ns("base", "http://www.w3.org/XML/1998/namespace") || root.attribute('xml:base') if root
base = base.join(xml_base) if xml_base
end

Expand Down
12 changes: 6 additions & 6 deletions lib/rdf/rdfa/reader/rexml.rb
Expand Up @@ -36,9 +36,9 @@ def initialize(node, parent = nil)
#
# @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")
Expand All @@ -51,7 +51,7 @@ def language
#
# @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
Expand Down Expand Up @@ -224,7 +224,7 @@ def initialize_xml(input, **options)
@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

Expand Down Expand Up @@ -331,7 +331,7 @@ def doc_base(base)
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

Expand Down
3 changes: 0 additions & 3 deletions lib/rdf/rdfa/vocab.rb
Expand Up @@ -155,7 +155,4 @@ module RDF
"dc:description": "is the class for all warnings".freeze,
subClassOf: "rdfa:PGClass".freeze
end

XML = Class.new(Vocabulary("http://www.w3.org/XML/1998/namespace"))
XSI = Class.new(Vocabulary("http://www.w3.org/2001/XMLSchema-instance"))
end

0 comments on commit 544c502

Please sign in to comment.