Sha256: 5173cff91e88ffd13f27db3ad4f6fd4f5cc9ece2342c15061625ff7766317074

Contents?: true

Size: 501 Bytes

Versions: 6

Compression:

Stored size: 501 Bytes

Contents

require 'nokogiri'
class Nokogiri::XML::Node
  # URI of namespace + node_name
  def uri
    ns = self.namespace ? self.namespace.href : RdfContext::XML_NS.uri.to_s
    RdfContext::URIRef.new(ns + self.node_name, :normalize => false)
  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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rdf_context-0.5.11 lib/rdf_context/nokogiri_hacks.rb
rdf_context-0.5.10 lib/rdf_context/nokogiri_hacks.rb
rdf_context-0.5.9.1 lib/rdf_context/nokogiri_hacks.rb
rdf_context-0.5.9 lib/rdf_context/nokogiri_hacks.rb
rdf_context-0.5.8.2 lib/rdf_context/nokogiri_hacks.rb
rdf_context-0.5.8.1 lib/rdf_context/nokogiri_hacks.rb