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



11
12
13
14
15
16
17
# File 'ext/nokogiri/xml_attribute_decl.c', line 11

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

#defaultObject

The default value



25
26
27
28
29
30
31
32
33
# File 'ext/nokogiri/xml_attribute_decl.c', line 25

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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'ext/nokogiri/xml_attribute_decl.c', line 41

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