Class LibXML::XML::AttrDecl

  1. ext/libxml/libxml.c
  2. lib/libxml/attr_decl.rb
  3. show all
Parent: Object

At attribute declaration is used in XML::Dtds to define what attributes are allowed on an element. An attribute declaration defines an attribues name, data type and default value (if any).

Included modules

  1. Enumerable

Public instance methods

attr_decl.child → nil

Obtain this attribute declaration’s child attribute(s). It will always be nil.

[show source]
    # File lib/libxml/attr_decl.rb, line 13
13:       def child
14:         nil
15:       end
attr_decl.child? → (true|false)

Returns whether this attribute declaration has child attributes.

[show source]
    # File lib/libxml/attr_decl.rb, line 22
22:       def child?
23:         not self.children.nil?
24:       end
attr_decl.doc → XML::Document

Returns this attribute declaration’s document.

[show source]
static VALUE rxml_attr_decl_doc_get(VALUE self)
{
  xmlAttributePtr xattr;
  Data_Get_Struct(self, xmlAttribute, xattr);
  if (xattr->doc == NULL)
    return Qnil;
  else
    return rxml_document_wrap(xattr->doc);
}
attr_decl.doc? → (true|false)

Determine whether this attribute declaration is associated with an XML::Document.

[show source]
    # File lib/libxml/attr_decl.rb, line 31
31:       def doc?
32:         not self.doc.nil?
33:       end
attr_decl.name → "name"

Obtain this attribute declaration’s name.

[show source]
static VALUE rxml_attr_decl_name_get(VALUE self)
{
  xmlAttributePtr xattr;
  Data_Get_Struct(self, xmlAttribute, xattr);

  if (xattr->name == NULL)
    return Qnil;
  else
    return rxml_str_new2((const char*) xattr->name, xattr->doc->encoding);
}
attr_decl.next → XML::AttrDecl

Obtain the next attribute declaration.

[show source]
static VALUE rxml_attr_decl_next_get(VALUE self)
{
  xmlAttributePtr xattr;
  Data_Get_Struct(self, xmlAttribute, xattr);
  if (xattr->next == NULL)
    return Qnil;
  else
    return rxml_attr_decl_wrap((xmlAttributePtr)xattr->next);
}
attr_decl.next? → (true|false)

Determine whether there is a next attribute declaration.

[show source]
    # File lib/libxml/attr_decl.rb, line 39
39:       def next?
40:         not self.next.nil?
41:       end
attr_decl.type → num

Obtain this attribute declaration’s type node type.

[show source]
static VALUE rxml_attr_decl_node_type(VALUE self)
{
  xmlAttrPtr xattr;
  Data_Get_Struct(self, xmlAttr, xattr);
  return INT2NUM(xattr->type);
}
attr_decl.node_type_name → 'attribute declaration'

Returns this attribute declaration’s node type name.

[show source]
    # File lib/libxml/attr_decl.rb, line 63
63:       def node_type_name
64:         if node_type == Node::ATTRIBUTE_DECL
65:           'attribute declaration'
66:         else
67:           raise(UnknownType, "Unknown node type: %n", node.node_type);
68:         end
69:       end
attr_decl.parent → XML::Dtd

Obtain this attribute declaration’s parent which is an instance of a XML::DTD.

[show source]
static VALUE rxml_attr_decl_parent_get(VALUE self)
{
  xmlAttributePtr xattr;
  Data_Get_Struct(self, xmlAttribute, xattr);

  if (xattr->parent == NULL)
    return Qnil;
  else
    return rxml_dtd_wrap(xattr->parent);
}
attr_decl.parent? → (true|false)

Determine whether this attribute declaration has a parent .

[show source]
    # File lib/libxml/attr_decl.rb, line 47
47:       def parent?
48:         not self.parent.nil?
49:       end
attr_decl.prev → (XML::AttrDecl | XML::ElementDecl)

Obtain the previous attribute declaration or the owning element declration (not implemented).

[show source]
static VALUE rxml_attr_decl_prev_get(VALUE self)
{
  xmlAttributePtr xattr;
  Data_Get_Struct(self, xmlAttribute, xattr);

  if (xattr->prev == NULL)
    return Qnil;
  else
    return rxml_attr_decl_wrap((xmlAttributePtr)xattr->prev);
}
attr_decl.prev? → (true|false)

Determine whether there is a previous attribute declaration.

[show source]
    # File lib/libxml/attr_decl.rb, line 55
55:       def prev?
56:         not self.prev.nil?
57:       end
attr_decl.to_s → string

Returns a string representation of this attribute declaration.

[show source]
    # File lib/libxml/attr_decl.rb, line 75
75:       def to_s
76:         "#{name} = #{value}"
77:       end
attr_decl.value → "value"

Obtain the default value of this attribute declaration.

[show source]
VALUE rxml_attr_decl_value_get(VALUE self)
{
  xmlAttributePtr xattr;

  Data_Get_Struct(self, xmlAttribute, xattr);

  if (xattr->defaultValue)
    return rxml_str_new2((const char *)xattr->defaultValue, xattr->doc->encoding);
  else
    return Qnil;
}