Class: LibXML::XML::AttrDecl
- Inherits:
-
Object
- Object
- LibXML::XML::AttrDecl
- Includes:
- Enumerable
- Defined in:
- ext/libxml/ruby_xml_attr_decl.c,
lib/libxml/attr_decl.rb,
ext/libxml/ruby_xml_attr_decl.c
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 Method Summary collapse
-
#child ⇒ Object
call-seq: attr_decl.child -> nil.
-
#child? ⇒ Boolean
call-seq: attr_decl.child? -> (true|false).
-
#doc ⇒ XML::Document
Returns this attribute declaration’s document.
-
#doc? ⇒ Boolean
call-seq: attr_decl.doc? -> (true|false).
-
#name ⇒ Object
Obtain this attribute declaration’s name.
-
#next ⇒ XML::AttrDecl
Obtain the next attribute declaration.
-
#next? ⇒ Boolean
call-seq: attr_decl.next? -> (true|false).
-
#type ⇒ Numeric
Obtain this attribute declaration’s type node type.
-
#node_type_name ⇒ Object
call-seq: attr_decl.node_type_name -> ‘attribute declaration’.
-
#parent ⇒ XML::Dtd
Obtain this attribute declaration’s parent which is an instance of a XML::DTD.
-
#parent? ⇒ Boolean
call-seq: attr_decl.parent? -> (true|false).
-
#prev ⇒ (XML::AttrDecl | XML::ElementDecl)
Obtain the previous attribute declaration or the owning element declration (not implemented).
-
#prev? ⇒ Boolean
call-seq: attr_decl.prev? -> (true|false).
-
#to_s ⇒ Object
call-seq: attr_decl.to_s -> string.
-
#value ⇒ Object
Obtain the default value of this attribute declaration.
Instance Method Details
#child ⇒ Object
call-seq:
attr_decl.child -> nil
Obtain this attribute declaration’s child attribute(s). It will always be nil.
11 12 13 |
# File 'lib/libxml/attr_decl.rb', line 11 def child nil end |
#child? ⇒ Boolean
call-seq:
attr_decl.child? -> (true|false)
Returns whether this attribute declaration has child attributes.
20 21 22 |
# File 'lib/libxml/attr_decl.rb', line 20 def child? not self.children.nil? end |
#doc ⇒ XML::Document
Returns this attribute declaration’s document.
50 51 52 53 54 55 56 57 58 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 50
static VALUE rxml_attr_decl_doc_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->doc == NULL)
return Qnil;
else
return rxml_document_wrap(xattribute->doc);
}
|
#doc? ⇒ Boolean
call-seq:
attr_decl.doc? -> (true|false)
Determine whether this attribute declaration is associated with an XML::Document.
29 30 31 |
# File 'lib/libxml/attr_decl.rb', line 29 def doc? not self.doc.nil? end |
#name ⇒ Object
Obtain this attribute declaration’s name.
67 68 69 70 71 72 73 74 75 76 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 67
static VALUE rxml_attr_decl_name_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->name == NULL)
return Qnil;
else
return rb_str_new2((const char*) xattribute->name);
}
|
#next ⇒ XML::AttrDecl
Obtain the next attribute declaration.
84 85 86 87 88 89 90 91 92 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 84
static VALUE rxml_attr_decl_next_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->next == NULL)
return Qnil;
else
return rxml_attr_decl_wrap((xmlAttributePtr)xattribute->next);
}
|
#next? ⇒ Boolean
call-seq:
attr_decl.next? -> (true|false)
Determine whether there is a next attribute declaration.
37 38 39 |
# File 'lib/libxml/attr_decl.rb', line 37 def next? not self.next.nil? end |
#type ⇒ Numeric
Obtain this attribute declaration’s type node type.
100 101 102 103 104 105 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 100
static VALUE rxml_attr_decl_node_type(VALUE self)
{
xmlAttrPtr xattr;
Data_Get_Struct(self, xmlAttr, xattr);
return INT2NUM(xattr->type);
}
|
#node_type_name ⇒ Object
call-seq:
attr_decl.node_type_name -> 'attribute declaration'
Returns this attribute declaration’s node type name.
61 62 63 64 65 66 67 |
# File 'lib/libxml/attr_decl.rb', line 61 def node_type_name if node_type == Node::ATTRIBUTE_DECL 'attribute declaration' else raise(UnknownType, "Unknown node type: %n", node.node_type); end end |
#parent ⇒ XML::Dtd
Obtain this attribute declaration’s parent which is an instance of a XML::DTD.
114 115 116 117 118 119 120 121 122 123 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 114
static VALUE rxml_attr_decl_parent_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->parent == NULL)
return Qnil;
else
return rxml_dtd_wrap(xattribute->parent);
}
|
#parent? ⇒ Boolean
call-seq:
attr_decl.parent? -> (true|false)
Determine whether this attribute declaration has a parent .
45 46 47 |
# File 'lib/libxml/attr_decl.rb', line 45 def parent? not self.parent.nil? end |
#prev ⇒ (XML::AttrDecl | XML::ElementDecl)
Obtain the previous attribute declaration or the owning element declration (not implemented).
132 133 134 135 136 137 138 139 140 141 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 132
static VALUE rxml_attr_decl_prev_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->prev == NULL)
return Qnil;
else
return rxml_attr_decl_wrap((xmlAttributePtr)xattribute->prev);
}
|
#prev? ⇒ Boolean
call-seq:
attr_decl.prev? -> (true|false)
Determine whether there is a previous attribute declaration.
53 54 55 |
# File 'lib/libxml/attr_decl.rb', line 53 def prev? not self.prev.nil? end |
#to_s ⇒ Object
call-seq:
attr_decl.to_s -> string
Returns a string representation of this attribute declaration.
73 74 75 |
# File 'lib/libxml/attr_decl.rb', line 73 def to_s "#{name} = #{value}" end |
#value ⇒ Object
Obtain the default value of this attribute declaration.
149 150 151 152 153 154 155 156 157 158 159 |
# File 'ext/libxml/ruby_xml_attr_decl.c', line 149
VALUE rxml_attr_decl_value_get(VALUE self)
{
xmlAttributePtr xattribute;
Data_Get_Struct(self, xmlAttribute, xattribute);
if (xattribute->defaultValue)
return rb_str_new2((const char *)xattribute->defaultValue);
else
return Qnil;
}
|