class LibXML::XML::Schema::Type
Public Instance Methods
annonymus_subtypes()
click to toggle source
# File lib/libxml/schema/type.rb, line 16 def annonymus_subtypes elements.select { |_, e| e.type.name.nil? } end
annonymus_subtypes_recursively(parent=nil)
click to toggle source
# File lib/libxml/schema/type.rb, line 20 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()
click to toggle source
static VALUE rxml_schema_type_annot(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
if(xtype != NULL && xtype->annot != NULL)
return get_annotation(xtype->annot);
else
return Qnil;
}
attributes()
click to toggle source
static VALUE
rxml_schema_type_attributes(VALUE self)
{
VALUE attributes;
xmlSchemaTypePtr xtype;
xmlSchemaAttributeUsePtr use;
xmlSchemaItemListPtr uses;
int i;
Data_Get_Struct(self, xmlSchemaType, xtype);
if (rb_iv_get(self, "@attributes") == Qnil) {
attributes = rb_ary_new();
rb_iv_set(self, "@attributes", attributes);
uses = xtype->attrUses;
if ((uses == NULL) || (uses->nbItems == 0))
return rb_iv_get(self, "@attributes");
for (i = 0; i < uses->nbItems; i++) {
use = (xmlSchemaAttributeUsePtr) uses->items[i];
rb_ary_push(attributes, rxml_wrap_schema_attribute(use));
}
}
return rb_iv_get(self, "@attributes");
}
base()
click to toggle source
static VALUE rxml_schema_type_base(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
return Data_Wrap_Struct(cXMLSchemaType, NULL, rxml_schema_type_free, xtype->baseType);
}
elements()
click to toggle source
static VALUE
rxml_schema_type_elements(VALUE self)
{
VALUE elements;
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
if (rb_iv_get(self, "@elements") == Qnil) {
elements = rb_hash_new();
rb_iv_set(self, "@elements", elements);
rxmlSchemaCollectElements((xmlSchemaParticlePtr) xtype->subtypes, self);
}
return rb_iv_get(self, "@elements");
}
facets()
click to toggle source
static VALUE rxml_schema_type_facets(VALUE self)
{
xmlSchemaTypePtr xtype;
xmlSchemaFacetPtr facet;
VALUE facets;
VALUE rfacet;
facets = rb_iv_get(self, "@facets");
if (facets == Qnil) {
facets = rb_ary_new();
Data_Get_Struct(self, xmlSchemaType, xtype);
facet = xtype->facets;
while (facet != NULL) {
rfacet = rxml_wrap_schema_facet((xmlSchemaFacetPtr) facet);
rb_ary_push(facets, rfacet);
facet = facet->next;
}
rb_iv_set(self, "@facets", facets);
}
return facets;
}
kind()
click to toggle source
static VALUE rxml_schema_type_kind(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
return INT2NUM(xtype->type);
}
kind_name()
click to toggle source
# File lib/libxml/schema/type.rb, line 4 def kind_name Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind } end
name()
click to toggle source
static VALUE rxml_schema_type_name(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
QNIL_OR_STRING(xtype->name)
}
namespace()
click to toggle source
static VALUE rxml_schema_type_namespace(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
QNIL_OR_STRING(xtype->targetNamespace)
}
node()
click to toggle source
static VALUE rxml_schema_type_node(VALUE self)
{
xmlSchemaTypePtr xtype;
Data_Get_Struct(self, xmlSchemaType, xtype);
if(xtype->node != NULL)
return rxml_node_wrap(xtype->node);
else
return Qnil;
}