Nokogiri::XML::AttributeDecl

class Nokogiri::XML::AttributeDecl

Parent:
Nokogiri::XML::Node

Represents an attribute declaration in a DTD

Public Instance Methods

attribute_type Show source

The #attribute_type for this AttributeDecl

static VALUE attribute_type(VALUE self)
{
  xmlAttributePtr node;
  Data_Get_Struct(self, xmlAttribute, node);
  return INT2NUM((long)node->atype);
}
default Show source

The default value

static VALUE default_value(VALUE self)
{
  xmlAttributePtr node;
  Data_Get_Struct(self, xmlAttribute, node);

  if(node->defaultValue) return NOKOGIRI_STR_NEW2(node->defaultValue);
  return Qnil;
}
enumeration Show source

An enumeration of possible values

static VALUE enumeration(VALUE self)
{
  xmlAttributePtr node;
  xmlEnumerationPtr enm;
  VALUE list;

  Data_Get_Struct(self, xmlAttribute, node);

  list = rb_ary_new();
  enm = node->tree;

  while(enm) {
    rb_ary_push(list, NOKOGIRI_STR_NEW2(enm->name));
    enm = enm->next;
  }

  return list;
}
inspect() Show source
# File lib/nokogiri/xml/attribute_decl.rb, line 13
def inspect
  "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{to_s.inspect}>"
end

© 2008–2016 Aaron Patterson, Mike Dalessio, Charles Nutter, Sergio Arbeo
Patrick Mahoney, Yoko Harada, Akinori Musha, John Shahid
Licensed under the MIT License.

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部