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



8
9
10
11
12
13
14
15
16
17
18
19
# File 'ext/nokogiri/xml_encoding_handler.c', line 8

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



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

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.



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

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

  return klass;
}

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

Delete the encoding alias named name



26
27
28
29
30
31
32
# File 'ext/nokogiri/xml_encoding_handler.c', line 26

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



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

static VALUE
name(VALUE self)
{
  xmlCharEncodingHandlerPtr handler;

  Data_Get_Struct(self, xmlCharEncodingHandler, handler);

  return NOKOGIRI_STR_NEW2(handler->name);
}