class LibXML::XML::AttrDecl
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).
Public Instance Methods
Source
# File lib/libxml/attr_decl.rb 13 def child 14 nil 15 end
Obtain this attribute declaration’s child attribute(s). It will always be nil.
Source
# File lib/libxml/attr_decl.rb 22 def child? 23 not self.children.nil? 24 end
Returns whether this attribute declaration has child attributes.
Source
static VALUE rxml_attr_decl_doc_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->doc == NULL)
return Qnil;
else
return rxml_registry_lookup(xattr->doc);
}
Returns this attribute declaration’s document.
Source
# File lib/libxml/attr_decl.rb 31 def doc? 32 not self.doc.nil? 33 end
Determine whether this attribute declaration is associated with an XML::Document.
Source
static VALUE rxml_attr_decl_name_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->name == NULL)
return Qnil;
else
return rxml_new_cstr( xattr->name, xattr->doc->encoding);
}
Obtain this attribute declaration’s name.
Source
static VALUE rxml_attr_decl_next_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->next == NULL)
return Qnil;
else
return rxml_attr_decl_wrap((xmlAttributePtr)xattr->next);
}
Obtain the next attribute declaration.
Source
# File lib/libxml/attr_decl.rb 39 def next? 40 not self.next.nil? 41 end
Determine whether there is a next attribute declaration.
Source
static VALUE rxml_attr_decl_node_type(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
return INT2NUM(xattr->type);
}
Obtain this attribute declaration’s type node type.
Source
# File lib/libxml/attr_decl.rb 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
Returns this attribute declaration’s node type name.
Source
static VALUE rxml_attr_decl_parent_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->parent == NULL)
return Qnil;
else
return rxml_dtd_wrap(xattr->parent);
}
Obtain this attribute declaration’s parent which is an instance of a XML::DTD.
Source
# File lib/libxml/attr_decl.rb 47 def parent? 48 not self.parent.nil? 49 end
Determine whether this attribute declaration has a parent .
Source
static VALUE rxml_attr_decl_prev_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->prev == NULL)
return Qnil;
else
return rxml_attr_decl_wrap((xmlAttributePtr)xattr->prev);
}
Obtain the previous attribute declaration or the owning element declration (not implemented).
Source
# File lib/libxml/attr_decl.rb 55 def prev? 56 not self.prev.nil? 57 end
Determine whether there is a previous attribute declaration.
Source
# File lib/libxml/attr_decl.rb 75 def to_s 76 "#{name} = #{value}" 77 end
Returns a string representation of this attribute declaration.
Source
VALUE rxml_attr_decl_value_get(VALUE self)
{
xmlAttributePtr xattr;
TypedData_Get_Struct(self, xmlAttribute, &rxml_attr_decl_type, xattr);
if (xattr->defaultValue)
return rxml_new_cstr(xattr->defaultValue, NULL);
else
return Qnil;
}
Obtain the default value of this attribute declaration.