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



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

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

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

  return Qnil;
}

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

Alias encoding handler with name from to name to



42
43
44
45
46
47
48
# File 'ext/nokogiri/xml_encoding_handler.c', line 42

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

  return to;
}

.Nokogiri::EncodingHandler.clear_aliases!Object

Remove all encoding aliases.



55
56
57
58
59
60
61
# File 'ext/nokogiri/xml_encoding_handler.c', line 55

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

  return klass;
}

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

Delete the encoding alias named name



29
30
31
32
33
34
35
# File 'ext/nokogiri/xml_encoding_handler.c', line 29

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

  return Qtrue;
}

Instance Method Details

#nameObject

Get the name of this EncodingHandler



68
69
70
71
72
73
74
75
76
# File 'ext/nokogiri/xml_encoding_handler.c', line 68

static VALUE
name(VALUE self)
{
  xmlCharEncodingHandlerPtr handler;

  Data_Get_Struct(self, xmlCharEncodingHandler, handler);

  return NOKOGIRI_STR_NEW2(handler->name);
}