Sha256: 1327a2821645f54f67ba47f54ef3a5a4cea2ea97760ea28668dd0234b2c7659a

Contents?: true

Size: 1.88 KB

Versions: 16

Compression:

Stored size: 1.88 KB

Contents

#include <xml_entity_decl.h> 

/*
 * call-seq:
 *  original_content
 *
 * Get the original_content before ref substitution
 */
static VALUE original_content(VALUE self)
{
  xmlEntityPtr node;
  Data_Get_Struct(self, xmlEntity, node);

  if(!node->orig) return Qnil;

  return NOKOGIRI_STR_NEW2(node->orig);
}

/*
 * call-seq:
 *  content
 *
 * Get the content
 */
static VALUE get_content(VALUE self)
{
  xmlEntityPtr node;
  Data_Get_Struct(self, xmlEntity, node);

  if(!node->content) return Qnil;

  return NOKOGIRI_STR_NEW(node->content, node->length);
}

/*
 * call-seq:
 *  content
 *
 * Get the entity type
 */
static VALUE entity_type(VALUE self)
{
  xmlEntityPtr node;
  Data_Get_Struct(self, xmlEntity, node);

  return INT2NUM((int)node->etype);
}

/*
 * call-seq:
 *  external_id
 *
 * Get the external identifier for PUBLIC
 */
static VALUE external_id(VALUE self)
{
  xmlEntityPtr node;
  Data_Get_Struct(self, xmlEntity, node);

  if(!node->ExternalID) return Qnil;

  return NOKOGIRI_STR_NEW2(node->ExternalID);
}

/*
 * call-seq:
 *  system_id
 *
 * Get the URI for a SYSTEM or PUBLIC Entity
 */
static VALUE system_id(VALUE self)
{
  xmlEntityPtr node;
  Data_Get_Struct(self, xmlEntity, node);

  if(!node->SystemID) return Qnil;

  return NOKOGIRI_STR_NEW2(node->SystemID);
}

VALUE cNokogiriXmlEntityDecl;

void init_xml_entity_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, "EntityDecl", node);

  cNokogiriXmlEntityDecl = klass;

  rb_define_method(klass, "original_content", original_content, 0);
  rb_define_method(klass, "content", get_content, 0);
  rb_define_method(klass, "entity_type", entity_type, 0);
  rb_define_method(klass, "external_id", external_id, 0);
  rb_define_method(klass, "system_id", system_id, 0);
}

Version data entries

16 entries across 16 versions & 6 rubygems

Version Path
rubyjedi-nokogiri_java-1.4.0.20100513161003-java ext/nokogiri/xml_entity_decl.c
jwagener-nokogiri-1.4.1 ext/nokogiri/xml_entity_decl.c
revo-nokogiri-1.4.1-java ext/nokogiri/xml_entity_decl.c
revo-nokogiri-1.4.0.3-java ext/nokogiri/xml_entity_decl.c
revo-nokogiri-1.4.0-java ext/nokogiri/xml_entity_decl.c
revo-nokogiri-1.4.0.20100202165440-java ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.1-x86-mswin32 ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.1-x86-mingw32 ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.1-java ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.1 ext/nokogiri/xml_entity_decl.c
superfeedr-nokogiri-1.4.0.20091116183308 ext/nokogiri/xml_entity_decl.c
caring-nokogiri-1.4.1.pre1 ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.0-java ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.0-x86-mswin32 ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.0-x86-mingw32 ext/nokogiri/xml_entity_decl.c
nokogiri-1.4.0 ext/nokogiri/xml_entity_decl.c