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
# File 'ext/nokogiri/xml_encoding_handler.c', line 8

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

  handler = xmlFindCharEncodingHandler(StringValuePtr(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



36
37
38
39
40
41
# File 'ext/nokogiri/xml_encoding_handler.c', line 36

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

  return to;
}

.Nokogiri::EncodingHandler.clear_aliases!Object

Remove all encoding aliases.



48
49
50
51
52
53
# File 'ext/nokogiri/xml_encoding_handler.c', line 48

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

  return klass;
}

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

Delete the encoding alias named name



24
25
26
27
28
29
# File 'ext/nokogiri/xml_encoding_handler.c', line 24

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

  return Qtrue;
}

Instance Method Details

#nameObject

Get the name of this EncodingHandler



60
61
62
63
64
65
66
67
# File 'ext/nokogiri/xml_encoding_handler.c', line 60

static VALUE name(VALUE self)
{
  xmlCharEncodingHandlerPtr handler;

  Data_Get_Struct(self, xmlCharEncodingHandler, handler);

  return NOKOGIRI_STR_NEW2(handler->name);
}