Class: LibXML::XML::Schema::Attribute
- Inherits:
-
Object
- Object
- LibXML::XML::Schema::Attribute
- Defined in:
- lib/libxml/schema/attribute.rb,
ext/libxml/ruby_xml_schema_attribute.c
Constant Summary collapse
- REQUIRED =
1
- OPTIONAL =
2
Instance Method Summary collapse
- #default ⇒ Object
- #name ⇒ Object
- #namespace ⇒ Object
- #node ⇒ Object
- #occurs ⇒ Object
- #required? ⇒ Boolean
- #type ⇒ Object
- #value ⇒ Object
Instance Method Details
#default ⇒ Object
9 10 11 |
# File 'lib/libxml/schema/attribute.rb', line 9 def default node['default'] end |
#name ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 39
static VALUE rxml_schema_attribute_name(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
const xmlChar *name;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
if (attr == NULL)
return Qnil;
if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
name = ((xmlSchemaAttributeUseProhibPtr) attr)->name;
} else if (attr->type == XML_SCHEMA_EXTRA_QNAMEREF) {
name = ((xmlSchemaQNameRefPtr) attr)->name;
} else {
xmlSchemaAttributePtr attrDecl = ((xmlSchemaAttributeUsePtr) attr)->attrDecl;
name = attrDecl->name;
}
QNIL_OR_STRING(name)
}
|
#namespace ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 18
static VALUE rxml_schema_attribute_namespace(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
const xmlChar *tns;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
if (attr == NULL)
return Qnil;
if (attr->type == XML_SCHEMA_EXTRA_ATTR_USE_PROHIB) {
tns = ((xmlSchemaAttributeUseProhibPtr) attr)->targetNamespace;
} else if (attr->type == XML_SCHEMA_EXTRA_QNAMEREF) {
tns = ((xmlSchemaQNameRefPtr) attr)->targetNamespace;
} else {
tns = ((xmlSchemaAttributePtr) ((xmlSchemaAttributeUsePtr) (attr))->attrDecl)->targetNamespace;
}
QNIL_OR_STRING(tns)
}
|
#node ⇒ Object
73 74 75 76 77 78 79 80 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 73
static VALUE rxml_schema_attribute_node(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
return rxml_node_wrap(attr->node);
}
|
#occurs ⇒ Object
91 92 93 94 95 96 97 98 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 91
static VALUE rxml_schema_attribute_occurs(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
return INT2NUM(attr->occurs);
}
|
#required? ⇒ Boolean
13 14 15 |
# File 'lib/libxml/schema/attribute.rb', line 13 def required? occurs == REQUIRED end |
#type ⇒ Object
61 62 63 64 65 66 67 68 69 70 71 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 61
static VALUE rxml_schema_attribute_type(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
xtype = attr->attrDecl->subtypes;
return rxml_wrap_schema_type((xmlSchemaTypePtr) xtype);
}
|
#value ⇒ Object
82 83 84 85 86 87 88 89 |
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 82
static VALUE rxml_schema_attribute_value(VALUE self)
{
xmlSchemaAttributeUsePtr attr;
Data_Get_Struct(self, xmlSchemaAttributeUse, attr);
QNIL_OR_STRING(attr->defValue)
}
|