Class: LibXML::XML::AttrDecl
Relationships & Source Files | |
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Enumerable
|
|
Inherits: | Object |
Defined in: | ext/libxml/ruby_xml_attr_decl.c, ext/libxml/ruby_xml_attr_decl.c, lib/libxml/attr_decl.rb |
Overview
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).
Instance Attribute Summary
-
#child ⇒ nil
readonly
Obtain this attribute declaration’s child attribute(s).
-
#child? ⇒ Boolean
readonly
Returns whether this attribute declaration has child attributes.
-
#doc ⇒ XML::Document
readonly
Returns this attribute declaration’s document.
-
#doc? ⇒ Boolean
readonly
Determine whether this attribute declaration is associated with an
Document
. -
#next ⇒ AttrDecl
readonly
Obtain the next attribute declaration.
-
#next? ⇒ Boolean
readonly
Determine whether there is a next attribute declaration.
-
#parent ⇒ XML::Dtd
readonly
Obtain this attribute declaration’s parent which is an instance of a
XML::DTD
. -
#parent? ⇒ Boolean
readonly
Determine whether this attribute declaration has a parent .
-
#prev ⇒ AttrDecl
readonly
Obtain the previous attribute declaration or the owning element declration (not implemented).
-
#prev? ⇒ Boolean
readonly
Determine whether there is a previous attribute declaration.
Instance Method Summary
-
#name ⇒ "name"
Obtain this attribute declaration’s name.
-
#type ⇒ Numeric
Obtain this attribute declaration’s type node type.
-
#node_type_name ⇒ 'attribute declaration'
Returns this attribute declaration’s node type name.
-
#to_s ⇒ String
Returns a string representation of this attribute declaration.
-
#value ⇒ "value"
Obtain the default value of this attribute declaration.
Instance Attribute Details
#child ⇒ nil
(readonly)
Obtain this attribute declaration’s child attribute(s). It will always be nil.
# File 'lib/libxml/attr_decl.rb', line 13
def child nil end
#child? ⇒ Boolean
(readonly)
Returns whether this attribute declaration has child attributes.
# File 'lib/libxml/attr_decl.rb', line 22
def child? not self.children.nil? end
#doc ⇒ XML::Document (readonly)
Returns this attribute declaration’s document.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 32
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); }
#doc? ⇒ Boolean
(readonly)
Determine whether this attribute declaration is associated with an Document
.
# File 'lib/libxml/attr_decl.rb', line 31
def doc? not self.doc.nil? end
#next ⇒ AttrDecl
(readonly)
Obtain the next attribute declaration.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 66
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); }
#next? ⇒ Boolean
(readonly)
Determine whether there is a next attribute declaration.
# File 'lib/libxml/attr_decl.rb', line 39
def next? not self.next.nil? end
#parent ⇒ XML::Dtd (readonly)
Obtain this attribute declaration’s parent which is an instance of a XML::DTD
.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 96
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); }
#parent? ⇒ Boolean
(readonly)
Determine whether this attribute declaration has a parent .
# File 'lib/libxml/attr_decl.rb', line 47
def parent? not self.parent.nil? end
#prev ⇒ AttrDecl
(readonly)
Obtain the previous attribute declaration or the owning element declration (not implemented).
# File 'ext/libxml/ruby_xml_attr_decl.c', line 114
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); }
#prev? ⇒ Boolean
(readonly)
Determine whether there is a previous attribute declaration.
# File 'lib/libxml/attr_decl.rb', line 55
def prev? not self.prev.nil? end
Instance Method Details
#name ⇒ "name"
Obtain this attribute declaration’s name.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 49
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_new_cstr( xattr->name, xattr->doc->encoding); }
#type ⇒ Numeric
Obtain this attribute declaration’s type node type.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 82
static VALUE rxml_attr_decl_node_type(VALUE self) { xmlAttrPtr xattr; Data_Get_Struct(self, xmlAttr, xattr); return INT2NUM(xattr->type); }
#node_type_name ⇒ 'attribute
declaration
'
Returns this attribute declaration’s node type name.
# File 'lib/libxml/attr_decl.rb', line 63
def node_type_name if node_type == Node::ATTRIBUTE_DECL 'attribute declaration' else raise(UnknownType, "Unknown node type: %n", node.node_type); end end
#to_s ⇒ String
Returns a string representation of this attribute declaration.
#value ⇒ "value"
Obtain the default value of this attribute declaration.
# File 'ext/libxml/ruby_xml_attr_decl.c', line 131
VALUE rxml_attr_decl_value_get(VALUE self) { xmlAttributePtr xattr; Data_Get_Struct(self, xmlAttribute, xattr); if (xattr->defaultValue) return rxml_new_cstr(xattr->defaultValue, NULL); else return Qnil; }