Sha256: 24ae8dc197c43612cd1e89911f83ac18b18f07385e83c7ba608ebf12d270dd18

Contents?: true

Size: 1.34 KB

Versions: 609

Compression:

Stored size: 1.34 KB

Contents

#include <xml_element_decl.h>

static ID id_document;

/*
 * call-seq:
 *  element_type
 *
 * The element_type
 */
static VALUE element_type(VALUE self)
{
  xmlElementPtr node;
  Data_Get_Struct(self, xmlElement, node);
  return INT2NUM((long)node->etype);
}

/*
 * call-seq:
 *  content
 *
 * The allowed content for this ElementDecl
 */
static VALUE content(VALUE self)
{
  xmlElementPtr node;
  Data_Get_Struct(self, xmlElement, node);

  if(!node->content) return Qnil;

  return Nokogiri_wrap_element_content(
      rb_funcall(self, id_document, 0),
      node->content
  );
}

/*
 * call-seq:
 *  prefix
 *
 * The namespace prefix for this ElementDecl
 */
static VALUE prefix(VALUE self)
{
  xmlElementPtr node;
  Data_Get_Struct(self, xmlElement, node);

  if(!node->prefix) return Qnil;

  return NOKOGIRI_STR_NEW2(node->prefix);
}

VALUE cNokogiriXmlElementDecl;

void init_xml_element_decl()
{
  VALUE nokogiri = rb_define_module("Nokogiri");
  VALUE xml = rb_define_module_under(nokogiri, "XML");
  VALUE node = rb_define_class_under(xml, "Node", rb_cObject);
  VALUE klass = rb_define_class_under(xml, "ElementDecl", node);

  cNokogiriXmlElementDecl = klass;

  rb_define_method(klass, "element_type", element_type, 0);
  rb_define_method(klass, "content", content, 0);
  rb_define_method(klass, "prefix", prefix, 0);

  id_document = rb_intern("document");
}

Version data entries

609 entries across 577 versions & 52 rubygems

Version Path
nokogiri-backport-1.11.0 ext/nokogiri/xml_element_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_element_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_element_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_element_decl.c
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_element_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_element_decl.c
tdiary-5.1.5 vendor/bundle/ruby/2.7.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_element_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/nokogiri-1.11.1-x86_64-linux/ext/nokogiri/xml_element_decl.c
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-5.1.4/vendor/bundle/ruby/2.7.0/gems/nokogiri-1.10.10/ext/nokogiri/xml_element_decl.c
video_chat_get-0.1.9 vendor/bundle/ruby/2.5.0/gems/nokogiri-1.10.9/ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1 ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-x86_64-linux ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-x86_64-darwin ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-x86-mingw32 ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-x86-linux ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-x64-mingw32 ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-java ext/nokogiri/xml_element_decl.c
nokogiri-1.11.1-arm64-darwin ext/nokogiri/xml_element_decl.c
nokogiri-1.11.0 ext/nokogiri/xml_element_decl.c
nokogiri-1.11.0-x86_64-linux ext/nokogiri/xml_element_decl.c