Class: LibXML::XML::Schema::Type
- Inherits:
-
Object
- Object
- LibXML::XML::Schema::Type
- Defined in:
- lib/libxml/schema/type.rb,
ext/libxml/ruby_xml_schema_type.c
Instance Method Summary collapse
- #annonymus_subtypes ⇒ Object
- #annonymus_subtypes_recursively(parent = nil) ⇒ Object
- #annotation ⇒ Object
- #attributes ⇒ Object
- #base ⇒ Object
- #elements ⇒ Object
- #facets ⇒ Object
- #kind ⇒ Object
- #kind_name ⇒ Object
- #name ⇒ Object
- #namespace ⇒ Object
- #node ⇒ Object
Instance Method Details
#annonymus_subtypes ⇒ Object
8 9 10 |
# File 'lib/libxml/schema/type.rb', line 8 def annonymus_subtypes elements.select { |_, e| e.type.name.nil? } end |
#annonymus_subtypes_recursively(parent = nil) ⇒ Object
12 13 14 15 16 17 |
# 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 ⇒ Object
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 92 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 ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 189 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 ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 41 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 ⇒ Object
178 179 180 181 182 183 184 185 186 187 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 178 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 ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 50 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 ⇒ Object
83 84 85 86 87 88 89 90 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 83 static VALUE rxml_schema_type_kind(VALUE self) { xmlSchemaTypePtr xtype; Data_Get_Struct(self, xmlSchemaType, xtype); return INT2NUM(xtype->type); } |
#kind_name ⇒ Object
4 5 6 |
# File 'lib/libxml/schema/type.rb', line 4 def kind_name Schema::Types.constants.find { |k| Schema::Types.const_get(k) == kind } end |
#name ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 32 static VALUE rxml_schema_type_name(VALUE self) { xmlSchemaTypePtr xtype; Data_Get_Struct(self, xmlSchemaType, xtype); QNIL_OR_STRING(xtype->name) } |
#namespace ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 23 static VALUE rxml_schema_type_namespace(VALUE self) { xmlSchemaTypePtr xtype; Data_Get_Struct(self, xmlSchemaType, xtype); QNIL_OR_STRING(xtype->targetNamespace) } |
#node ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'ext/libxml/ruby_xml_schema_type.c', line 71 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; } |