Sha256: 582969f4e59232249244ad12ad6bb4abbe24c0ecddaafdbcd6799a0e0f095a2a

Contents?: true

Size: 860 Bytes

Versions: 15

Compression:

Stored size: 860 Bytes

Contents

#include <xml_text.h>

/*
 * call-seq:
 *  new(content, document)
 *
 * Create a new Text element on the +document+ with +content+
 */
static VALUE new(VALUE klass, VALUE string, VALUE document)
{
  xmlDocPtr doc;
  Data_Get_Struct(document, xmlDoc, doc);

  xmlNodePtr node = xmlNewText((xmlChar *)StringValuePtr(string));
  node->doc = doc;

  VALUE rb_node = Nokogiri_wrap_xml_node(node) ;

  if(rb_block_given_p()) rb_yield(rb_node);

  return rb_node;
}

VALUE cNokogiriXmlText ;
void init_xml_text()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");
  /* */
  VALUE node = rb_define_class_under(xml, "Node", rb_cObject);

  /*
   * Wraps Text nodes.
   */
  VALUE klass = rb_define_class_under(xml, "Text", node);

  cNokogiriXmlText = klass;

  rb_define_singleton_method(klass, "new", new, 2);
}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
nokogiri-1.1.1-java ext/nokogiri/xml_text.c
nokogiri-1.1.1-x86-mswin32-60 ext/nokogiri/xml_text.c
nokogiri-1.2.0-x86-mswin32-60 ext/nokogiri/xml_text.c
nokogiri-1.1.1 ext/nokogiri/xml_text.c
nokogiri-1.2.0-java ext/nokogiri/xml_text.c
nokogiri-1.2.1-java ext/nokogiri/xml_text.c
nokogiri-1.2.0 ext/nokogiri/xml_text.c
nokogiri-1.2.1 ext/nokogiri/xml_text.c
nokogiri-1.2.2-x86-mswin32-60 ext/nokogiri/xml_text.c
nokogiri-1.2.2-java ext/nokogiri/xml_text.c
nokogiri-1.2.2 ext/nokogiri/xml_text.c
nokogiri-1.2.1-x86-mswin32-60 ext/nokogiri/xml_text.c
nokogiri-1.2.3-java ext/nokogiri/xml_text.c
nokogiri-1.2.3-x86-mswin32-60 ext/nokogiri/xml_text.c
nokogiri-1.2.3 ext/nokogiri/xml_text.c