Class: Nokogiri::EncodingHandler

Inherits:
Object
  • Object
show all
Defined in:
ext/nokogiri/xml_encoding_handler.c

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.Nokogiri::EncodingHandler.[](name) ⇒ Object

Get the encoding handler for name


19
20
21
22
23
24
25
26
27
28
29
30
# File 'ext/nokogiri/xml_encoding_handler.c', line 19

static VALUE
rb_xml_encoding_handler_s_get(VALUE klass, VALUE key)
{
  xmlCharEncodingHandlerPtr handler;

  handler = xmlFindCharEncodingHandler(StringValueCStr(key));
  if (handler) {
    return Data_Wrap_Struct(klass, NULL, _xml_encoding_handler_dealloc, handler);
  }

  return Qnil;
}

.Nokogiri::EncodingHandler.alias(from, to) ⇒ Object

Alias encoding handler with name from to name to


52
53
54
55
56
57
58
# File 'ext/nokogiri/xml_encoding_handler.c', line 52

static VALUE
rb_xml_encoding_handler_s_alias(VALUE klass, VALUE from, VALUE to)
{
  xmlAddEncodingAlias(StringValueCStr(from), StringValueCStr(to));

  return to;
}

.Nokogiri::EncodingHandler.clear_aliases!Object

Remove all encoding aliases.


66
67
68
69
70
71
72
# File 'ext/nokogiri/xml_encoding_handler.c', line 66

static VALUE
rb_xml_encoding_handler_s_clear_aliases(VALUE klass)
{
  xmlCleanupEncodingAliases();

  return klass;
}

.Nokogiri::EncodingHandler.delete(name) ⇒ Object

Delete the encoding alias named name


38
39
40
41
42
43
44
# File 'ext/nokogiri/xml_encoding_handler.c', line 38

static VALUE
rb_xml_encoding_handler_s_delete(VALUE klass, VALUE name)
{
  if (xmlDelEncodingAlias(StringValueCStr(name))) { return Qnil; }

  return Qtrue;
}

Instance Method Details

#nameObject

Get the name of this EncodingHandler


80
81
82
83
84
85
86
87
88
# File 'ext/nokogiri/xml_encoding_handler.c', line 80

static VALUE
rb_xml_encoding_handler_name(VALUE self)
{
  xmlCharEncodingHandlerPtr handler;

  Data_Get_Struct(self, xmlCharEncodingHandler, handler);

  return NOKOGIRI_STR_NEW2(handler->name);
}