Install
sudo gem install nokogiri
Contribute
github.com/tenderlove/nokogiri

An HTML, XML, SAX, & Reader parser with the ability to search documents via XPath or CSS3 selectors… and much more

Nokogiri

Class Nokogiri::HTML::ElementDescription inherits from Object

Public Class Methods

[](p1) Show Source

Get ElemementDescription for tag_name

static VALUE get_description(VALUE klass, VALUE tag_name) { const htmlElemDesc * description = htmlTagLookup( (const xmlChar *)StringValuePtr(tag_name) ); if(NULL == description) return Qnil; return Data_Wrap_Struct(klass, 0, 0, (void *)description); }

Public Instance Methods

block?() Show Source

Is this element a block element?

# File lib/nokogiri/html/element_description.rb, line 6 def block? !inline? end
default_sub_element() Show Source

The default sub element for this element

static VALUE default_sub_element(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); return NOKOGIRI_STR_NEW2(description->defaultsubelt); }
deprecated?() Show Source

Is this element deprecated?

static VALUE deprecated_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->depr) return Qtrue; return Qfalse; }
deprecated_attributes() Show Source

A list of deprecated attributes for this element

static VALUE deprecated_attributes(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); VALUE list = rb_ary_new(); if(NULL == description->attrs_depr) return list; int i = 0; while(description->attrs_depr[i]) { rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_depr[i])); i++; } return list; }
description() Show Source

The description for this element

static VALUE description(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); return NOKOGIRI_STR_NEW2(description->desc); }
empty?() Show Source

Is this an empty element?

static VALUE empty_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->empty) return Qtrue; return Qfalse; }
implied_end_tag?() Show Source

Can the end tag be implied for this tag?

static VALUE implied_end_tag_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->endTag) return Qtrue; return Qfalse; }
implied_start_tag?() Show Source

Can the start tag be implied for this tag?

static VALUE implied_start_tag_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->startTag) return Qtrue; return Qfalse; }
inline?() Show Source

Is this element an inline element?

static VALUE inline_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->isinline) return Qtrue; return Qfalse; }
inspect() Show Source

Inspection information

# File lib/nokogiri/html/element_description.rb, line 18 def inspect "#<#{self.class.name}: #{name} #{description}>" end
name() Show Source

Get the tag name for this ElemementDescription

static VALUE name(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(NULL == description->name) return Qnil; return NOKOGIRI_STR_NEW2(description->name); }
optional_attributes() Show Source

A list of optional attributes for this element

static VALUE optional_attributes(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); VALUE list = rb_ary_new(); if(NULL == description->attrs_opt) return list; int i = 0; while(description->attrs_opt[i]) { rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_opt[i])); i++; } return list; }
required_attributes() Show Source

A list of required attributes for this element

static VALUE required_attributes(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); VALUE list = rb_ary_new(); if(NULL == description->attrs_req) return list; int i = 0; while(description->attrs_req[i]) { rb_ary_push(list, NOKOGIRI_STR_NEW2(description->attrs_req[i])); i++; } return list; }
save_end_tag?() Show Source

Should the end tag be saved?

static VALUE save_end_tag_eh(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); if(description->saveEndTag) return Qtrue; return Qfalse; }
sub_elements() Show Source

A list of allowed sub elements for this element.

static VALUE sub_elements(VALUE self) { htmlElemDesc * description; Data_Get_Struct(self, htmlElemDesc, description); VALUE list = rb_ary_new(); if(NULL == description->subelts) return list; int i = 0; while(description->subelts[i]) { rb_ary_push(list, NOKOGIRI_STR_NEW2(description->subelts[i])); i++; } return list; }
to_s() Show Source

Convert this description to a string

# File lib/nokogiri/html/element_description.rb, line 12 def to_s "#{name}: #{description}" end