Class: LibXML::XML::Schema::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/libxml/schema/attribute.rb,
ext/libxml/ruby_xml_schema_attribute.c

Constant Summary collapse

REQUIRED =
1
OPTIONAL =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

#namespaceObject (readonly)

#occursObject (readonly)

#typeObject (readonly)

#valueObject (readonly)

Instance Method Details

#defaultObject

call-seq:

attribute.default -> String or nil

Returns the default value for this attribute, or nil if none.



13
14
15
# File 'lib/libxml/schema/attribute.rb', line 13

def default
  node['default']
end

#nodeObject



88
89
90
91
92
93
94
95
# File 'ext/libxml/ruby_xml_schema_attribute.c', line 88

static VALUE rxml_schema_attribute_node(VALUE self)
{
  xmlSchemaAttributeUsePtr attr;

  TypedData_Get_Struct(self, xmlSchemaAttributeUse, &rxml_schema_attribute_type, attr);

  return rxml_node_wrap(attr->node);
}

#required?Boolean

call-seq:

attribute.required? -> true or false

Returns whether this attribute is required.

Returns:

  • (Boolean)


21
22
23
# File 'lib/libxml/schema/attribute.rb', line 21

def required?
  occurs == REQUIRED
end