class LibXML::XML::Schema::Type

Attributes

kind[R]
name[R]
namespace[R]

Public Instance Methods

annonymus_subtypes() click to toggle source
   # File lib/libxml/schema/type.rb
 8 def annonymus_subtypes
 9   elements.select { |_, e| e.type.name.nil? }
10 end
annonymus_subtypes_recursively(parent=nil) click to toggle source
   # File lib/libxml/schema/type.rb
12 def annonymus_subtypes_recursively(parent=nil)
13   annonymus_subtypes.map do |element_name, e|
14     [{[parent, element_name].compact.join('::') => e.type},
15      e.type.annonymus_subtypes_recursively(element_name)]
16   end.flatten
17 end
annotation() click to toggle source
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() click to toggle source
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() click to toggle source
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;
}
elements() click to toggle source
static VALUE rxml_schema_type_elements(VALUE self)
{
  VALUE result = rb_hash_new();
  xmlSchemaTypePtr xtype;

  Data_Get_Struct(self, xmlSchemaType, xtype);
  rxmlSchemaCollectElements((xmlSchemaParticlePtr) xtype->subtypes, result);

  return result;
}
facets() click to toggle source
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() click to toggle source
  # File lib/libxml/schema/type.rb
4 def kind_name
5   Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind }
6 end
node() click to toggle source
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;
}