123456789_123456789_123456789_123456789_123456789_

Class: LibXML::XML::Schema::Type

Relationships & Source Files
Inherits: Object
Defined in: ext/libxml/ruby_xml_schema_type.c,
lib/libxml/schema/type.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#kind (readonly)

[ GitHub ]

#namespace (readonly)

[ GitHub ]

Instance Method Details

#annonymus_subtypes

[ GitHub ]

  
# File 'lib/libxml/schema/type.rb', line 8

def annonymus_subtypes
  elements.select { |_, e| e.type.name.nil? }
end

#annonymus_subtypes_recursively(parent = nil)

[ GitHub ]

  
# File 'lib/libxml/schema/type.rb', line 12

def annonymus_subtypes_recursively(parent=nil)
  annonymus_subtypes.map do |element_name, e|
    [{[parent, element_name].compact.join('::') => e.type},
     e.type.annonymus_subtypes_recursively(element_name)]
  end.flatten
end

#annotation

[ GitHub ]

  
# File 'ext/libxml/ruby_xml_schema_type.c', line 110

static VALUE rxml_schema_type_annot(VALUE self)
{
  VALUE result = Qnil;
  xmlSchemaTypePtr xtype;

  Data_Get_Struct(self, xmlSchemaType, xtype);

  if(xtype != NULL && xtype->annot != NULL && xtype->annot->content != NULL)
  {
    xmlChar *content = xmlNodeGetContent(xtype->annot->content);
	if (content)
	{
	  result = rxml_new_cstr(content, NULL);
	  xmlFree(content);
    }
  }
  return result;
}

#attributes

[ GitHub ]

  
# File 'ext/libxml/ruby_xml_schema_type.c', line 207

static VALUE rxml_schema_type_attributes(VALUE self)
{
  VALUE result = rb_ary_new();
  xmlSchemaTypePtr xtype;
  xmlSchemaAttributeUsePtr xuse;
  xmlSchemaItemListPtr xuses;
  int i;

  Data_Get_Struct(self, xmlSchemaType, xtype);
  xuses = xtype->attrUses;

  if (xuses != NULL)
  {
    for (i = 0; i < xuses->nbItems; i++)
	{
      xuse = (xmlSchemaAttributeUsePtr)xuses->items[i];
      rb_ary_push(result, rxml_wrap_schema_attribute(xuse));
    }
  }

  return result;
}

#base

[ GitHub ]

  
# File 'ext/libxml/ruby_xml_schema_type.c', line 71

static VALUE rxml_schema_type_base(VALUE self)
{
  xmlSchemaTypePtr xtype;

  Data_Get_Struct(self, xmlSchemaType, xtype);

  return (xtype->baseType != xtype) ? rxml_wrap_schema_type(xtype->baseType) : Qnil;
}

#facets

[ GitHub ]

  
# File 'ext/libxml/ruby_xml_schema_type.c', line 89

static VALUE rxml_schema_type_facets(VALUE self)
{
  xmlSchemaTypePtr xtype;
  xmlSchemaFacetPtr xfacet;
  VALUE result = rb_ary_new();
  VALUE facet;

  Data_Get_Struct(self, xmlSchemaType, xtype);

  xfacet = xtype->facets;

  while (xfacet != NULL)
  {
    facet = rxml_wrap_schema_facet((xmlSchemaFacetPtr)xfacet);
    rb_ary_push(result, facet);
    xfacet = xfacet->next;
  }

  return result;
}

#kind_name

[ GitHub ]

  
# File 'lib/libxml/schema/type.rb', line 4

def kind_name
  Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind }
end

#node

[ GitHub ]

  
# File 'ext/libxml/ruby_xml_schema_type.c', line 80

static VALUE rxml_schema_type_node(VALUE self)
{
  xmlSchemaTypePtr xtype;

  Data_Get_Struct(self, xmlSchemaType, xtype);

  return (xtype->node != NULL) ? rxml_node_wrap(xtype->node) : Qnil;
}