Sha256: 972cb7bc9e38dc588972c993a4097400552f92fa140c43903dfebe712eb027b1

Contents?: true

Size: 1.07 KB

Versions: 261

Compression:

Stored size: 1.07 KB

Contents

#include <nokogiri.h>

VALUE cNokogiriXmlEntityReference;

/*
 * call-seq:
 *  new(document, content)
 *
 * Create a new EntityReference element on the +document+ with +name+
 */
static VALUE
new (int argc, VALUE *argv, VALUE klass)
{
  xmlDocPtr xml_doc;
  xmlNodePtr node;
  VALUE document;
  VALUE name;
  VALUE rest;
  VALUE rb_node;

  rb_scan_args(argc, argv, "2*", &document, &name, &rest);

  xml_doc = noko_xml_document_unwrap(document);

  node = xmlNewReference(
           xml_doc,
           (const xmlChar *)StringValueCStr(name)
         );

  noko_xml_document_pin_node(node);

  rb_node = noko_xml_node_wrap(klass, node);
  rb_obj_call_init(rb_node, argc, argv);

  if (rb_block_given_p()) { rb_yield(rb_node); }

  return rb_node;
}

void
noko_init_xml_entity_reference(void)
{
  assert(cNokogiriXmlNode);
  /*
   * EntityReference represents an EntityReference node in an xml document.
   */
  cNokogiriXmlEntityReference = rb_define_class_under(mNokogiriXml, "EntityReference", cNokogiriXmlNode);

  rb_define_singleton_method(cNokogiriXmlEntityReference, "new", new, -1);
}

Version data entries

261 entries across 261 versions & 7 rubygems

Version Path
nokogiri-1.16.8-x86_64-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-x86_64-darwin ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-x64-mingw-ucrt ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-x64-mingw32 ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-java ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8 ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-arm-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-arm64-darwin ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.8-aarch64-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7 ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x86_64-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x86_64-darwin ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x86-mingw32 ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x86-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x64-mingw32 ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-x64-mingw-ucrt ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-java ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-arm64-darwin ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-arm-linux ext/nokogiri/xml_entity_reference.c
nokogiri-1.16.7-aarch64-linux ext/nokogiri/xml_entity_reference.c