Class: Nokogiri::XML::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rdf_context/nokogiri_hacks.rb

Instance Method Summary collapse

Instance Method Details

#display_pathObject



8
9
10
11
12
13
14
# File 'lib/rdf_context/nokogiri_hacks.rb', line 8

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

#uriObject

URI of namespace + node_name



4
5
6
7
# File 'lib/rdf_context/nokogiri_hacks.rb', line 4

def uri
  ns = self.namespace ? self.namespace.href : RdfContext::XML_NS.uri.to_s
  RdfContext::URIRef.new(ns + self.node_name, :normalize => false)
end