Sha256: 35f01e47fbeba87b492e2c1e684eae5e12f97775d529663f640fde508f4b5e97

Contents?: true

Size: 924 Bytes

Versions: 66

Compression:

Stored size: 924 Bytes

Contents

#include <nokogiri.h>

VALUE cNokogiriHtml4SaxParser;

static ID id_start_document;

static void
noko_html4_sax_parser_start_document(void *ctx)
{
  xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr)ctx;
  VALUE self = (VALUE)ctxt->_private;
  VALUE doc = rb_iv_get(self, "@document");

  xmlSAX2StartDocument(ctx);

  rb_funcall(doc, id_start_document, 0);
}

static VALUE
noko_html4_sax_parser_initialize(VALUE self)
{
  xmlSAXHandlerPtr handler = noko_xml_sax_parser_unwrap(self);

  rb_call_super(0, NULL);

  handler->startDocument = noko_html4_sax_parser_start_document;

  return self;
}

void
noko_init_html4_sax_parser(void)
{
  cNokogiriHtml4SaxParser = rb_define_class_under(mNokogiriHtml4Sax, "Parser", cNokogiriXmlSaxParser);

  rb_define_private_method(cNokogiriHtml4SaxParser, "initialize_native",
                           noko_html4_sax_parser_initialize, 0);

  id_start_document = rb_intern("start_document");
}

Version data entries

66 entries across 66 versions & 1 rubygems

Version Path
nokogiri-1.18.1-x86_64-linux-musl ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-x86_64-linux-gnu ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-x86_64-darwin ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-x64-mingw-ucrt ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-java ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1 ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-arm-linux-musl ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-arm-linux-gnu ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-arm64-darwin ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-aarch64-linux-musl ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.1-aarch64-linux-gnu ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-x86_64-linux-musl ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-x86_64-linux-gnu ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-x86_64-darwin ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-x64-mingw-ucrt ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-java ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0 ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-arm-linux-musl ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-arm-linux-gnu ext/nokogiri/html4_sax_parser.c
nokogiri-1.18.0-arm64-darwin ext/nokogiri/html4_sax_parser.c