Class: Nokogiri::XML::Namespace

Inherits:
Object
  • Object
show all
Includes:
PP::Node
Defined in:
lib/nokogiri/xml/namespace.rb,
ext/nokogiri/xml_namespace.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from PP::Node

#inspect, #pretty_print

Instance Attribute Details

#documentObject (readonly)

Returns the value of attribute document.



5
6
7
# File 'lib/nokogiri/xml/namespace.rb', line 5

def document
  @document
end

Instance Method Details

#hrefObject

Get the href for this namespace



30
31
32
33
34
35
36
37
38
39
40
41
# File 'ext/nokogiri/xml_namespace.c', line 30

static VALUE href(VALUE self)
{
  xmlNsPtr ns;
  xmlDocPtr doc;

  Data_Get_Struct(self, xmlNs, ns);
  if(!ns->href) return Qnil;

  Data_Get_Struct(rb_iv_get(self, "@document"), xmlDoc, doc);

  return NOKOGIRI_STR_NEW2(ns->href);
}

#prefixObject

Get the prefix for this namespace. Returns nil if there is no prefix.



11
12
13
14
15
16
17
18
19
20
21
22
# File 'ext/nokogiri/xml_namespace.c', line 11

static VALUE prefix(VALUE self)
{
  xmlNsPtr ns;
  xmlDocPtr doc;

  Data_Get_Struct(self, xmlNs, ns);
  if(!ns->prefix) return Qnil;

  Data_Get_Struct(rb_iv_get(self, "@document"), xmlDoc, doc);

  return NOKOGIRI_STR_NEW2(ns->prefix);
}