Module: RDF::RDFXML::Reader::Nokogiri
- Defined in:
- vendor/bundler/ruby/3.3.0/bundler/gems/rdf-rdfxml-6b89d4c13d63/lib/rdf/rdfxml/reader/nokogiri.rb
Overview
Nokogiri implementation of an XML parser.
Defined Under Namespace
Classes: NodeProxy, NodeSetProxy
Class Method Summary collapse
-
.library ⇒ Symbol
Returns the name of the underlying XML library.
Instance Method Summary collapse
-
#doc_errors ⇒ Object
Document errors.
-
#initialize_xml(input, **options)
Initializes the underlying XML library.
-
#root ⇒ Object
Return proxy for document root.
Class Method Details
.library ⇒ Symbol
Returns the name of the underlying XML library.
12 13 14 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-rdfxml-6b89d4c13d63/lib/rdf/rdfxml/reader/nokogiri.rb', line 12 def self.library :nokogiri end |
Instance Method Details
#doc_errors ⇒ Object
Document errors
259 260 261 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-rdfxml-6b89d4c13d63/lib/rdf/rdfxml/reader/nokogiri.rb', line 259 def doc_errors @doc.errors end |
#initialize_xml(input, **options)
This method returns an undefined value.
Initializes the underlying XML library.
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 |
# File 'vendor/bundler/ruby/3.3.0/bundler/gems/rdf-rdfxml-6b89d4c13d63/lib/rdf/rdfxml/reader/nokogiri.rb', line 230 def initialize_xml(input, **) require 'nokogiri' unless defined?(::Nokogiri) @doc = case input when ::Nokogiri::XML::Document input else # Try to detect charset from input [:encoding] ||= input.charset if input.respond_to?(:charset) # Otherwise, default is utf-8 [:encoding] ||= 'utf-8' [:encoding] = [:encoding].to_s if [:encoding] ::Nokogiri::XML.parse(input.respond_to?(:read) ? input.read : input.to_s, base_uri.to_s, [:encoding]) do |config| config.noent end end end |