class LibXML::XML::Schema::Attribute

Constants

OPTIONAL
REQUIRED

Public Instance Methods

default() click to toggle source
# File lib/libxml/schema/attribute.rb, line 8
def default
  node['default']
end
name() click to toggle source
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() click to toggle source
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() click to toggle source
static VALUE rxml_schema_attribute_node(VALUE self)
{
  xmlSchemaAttributeUsePtr attr;

  Data_Get_Struct(self, xmlSchemaAttributeUse, attr);

  return rxml_node_wrap(attr->node);
}
occurs() click to toggle source
static VALUE rxml_schema_attribute_occurs(VALUE self)
{
  xmlSchemaAttributeUsePtr attr;

  Data_Get_Struct(self, xmlSchemaAttributeUse, attr);

  return INT2NUM(attr->occurs);
}
required?() click to toggle source
# File lib/libxml/schema/attribute.rb, line 12
def required?
  occurs == REQUIRED
end
type() click to toggle source
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() click to toggle source
static VALUE rxml_schema_attribute_value(VALUE self)
{
  xmlSchemaAttributeUsePtr attr;

  Data_Get_Struct(self, xmlSchemaAttributeUse, attr);

  QNIL_OR_STRING(attr->defValue)
}