Class: Nokogiri::XML::AttributeDecl

Inherits:
Node
  • Object
show all
Defined in:
lib/nokogiri/xml/attribute_decl.rb,
ext/nokogiri/xml_attribute_decl.c

Overview

Represents an attribute declaration in a DTD

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Nokogiri::XML::Node

Instance Method Details

#attribute_typeObject

The attribute_type for this AttributeDecl



9
10
11
12
13
14
# File 'ext/nokogiri/xml_attribute_decl.c', line 9

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

#defaultObject

The default value



22
23
24
25
26
27
28
29
# File 'ext/nokogiri/xml_attribute_decl.c', line 22

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;
}

#enumerationObject

An enumeration of possible values



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'ext/nokogiri/xml_attribute_decl.c', line 37

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;
}

#inspectObject



14
15
16
# File 'lib/nokogiri/xml/attribute_decl.rb', line 14

def inspect
  "#<#{self.class.name}:#{sprintf("0x%x", object_id)} #{to_s.inspect}>"
end