Sha256: 1d63ab9236318850ffe3f9f495ef49fb3d03a1b1b3a40c3e461405fc9acc12d3

Contents?: true

Size: 552 Bytes

Versions: 10

Compression:

Stored size: 552 Bytes

Contents

require 'nokogiri'
class Nokogiri::XML::Node
  # URI of namespace + node_name
  def uri
    ns = self.namespace ? self.namespace.href : RDF::XML.to_s
    RDF::URI.intern(ns + self.node_name)
  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
  def doctype
    self.children.first rescue false
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rdf-rdfa-0.3.7 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.6 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.5.1 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.4.2 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.4.1 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.4 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.3.3 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.3.2 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.3.1 lib/rdf/rdfa/patches/nokogiri_hacks.rb
rdf-rdfa-0.3.3 lib/rdf/rdfa/patches/nokogiri_hacks.rb