Sha256: 450c37a06a65996f1281d28558dbc421634e22022d5fbdcbd26bea5e9f022295

Contents?: true

Size: 1.18 KB

Versions: 5

Compression:

Stored size: 1.18 KB

Contents

#include <html_sax_parser.h>

static VALUE native_parse_file(VALUE self, VALUE data, VALUE encoding)
{
  xmlSAXHandlerPtr handler;
  htmlDocPtr hdoc ;
  Data_Get_Struct(self, xmlSAXHandler, handler);
  hdoc = htmlSAXParseFile( StringValuePtr(data),
                           (const char *)StringValuePtr(encoding),
                           (htmlSAXHandlerPtr)handler,
                           (void *)self );
  xmlFreeDoc(hdoc);
  return data;
}

static VALUE native_parse_memory(VALUE self, VALUE data, VALUE encoding)
{
  xmlSAXHandlerPtr handler;
  htmlDocPtr hdoc ;
  Data_Get_Struct(self, xmlSAXHandler, handler);
  hdoc = htmlSAXParseDoc(  (xmlChar *)StringValuePtr(data),
                           (const char *)StringValuePtr(encoding),
                           (htmlSAXHandlerPtr)handler,
                           (void *)self );
  xmlFreeDoc(hdoc);
  return data;
}

VALUE cNokogiriHtmlSaxParser ;
void init_html_sax_parser()
{
  VALUE klass = cNokogiriHtmlSaxParser =
    rb_const_get(mNokogiriHtmlSax, rb_intern("Parser"));
  rb_define_private_method(klass, "native_parse_memory", native_parse_memory, 2);
  rb_define_private_method(klass, "native_parse_file", native_parse_file, 2);
}

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nokogiri-1.1.1-x86-mswin32-60 ext/nokogiri/html_sax_parser.c
nokogiri-1.1.1-java ext/nokogiri/html_sax_parser.c
nokogiri-1.1.0-x86-mswin32-60 ext/nokogiri/html_sax_parser.c
nokogiri-1.1.0 ext/nokogiri/html_sax_parser.c
nokogiri-1.1.1 ext/nokogiri/html_sax_parser.c