Class: LibXML::XML::Schema::Element
- Inherits:
-
Object
- Object
- LibXML::XML::Schema::Element
- Defined in:
- lib/libxml/schema/element.rb,
ext/libxml/ruby_xml_schema_element.c
Instance Method Summary collapse
- #annotation ⇒ Object
- #array? ⇒ Boolean
- #elements ⇒ Object
- #max_occurs ⇒ Object
- #min_occurs ⇒ Object
- #name ⇒ Object
- #namespace ⇒ Object
- #node ⇒ Object
- #required? ⇒ Boolean
- #type ⇒ Object
- #value ⇒ Object
Instance Method Details
#annotation ⇒ Object
77 78 79 80 81 82 83 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 77 def annotation return if node.nil? annotations = node.children.select { |n| n.name == 'annotation' } annotations.map do |annotation| annotation.children.map(&:content).join("\n") end.join("\n") end |
#array? ⇒ Boolean
10 11 12 |
# File 'lib/libxml/schema/element.rb', line 10 def array? max_occurs > 1 end |
#elements ⇒ Object
14 15 16 |
# File 'lib/libxml/schema/element.rb', line 14 def elements type.elements end |
#max_occurs ⇒ Object
72 73 74 75 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 72 static VALUE rxml_schema_element_max_occurs(VALUE self) { return rb_iv_get(self, "@max"); } |
#min_occurs ⇒ Object
67 68 69 70 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 67 static VALUE rxml_schema_element_min_occurs(VALUE self) { return rb_iv_get(self, "@min"); } |
#name ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 27 static VALUE rxml_schema_element_name(VALUE self) { xmlSchemaElementPtr xelem; Data_Get_Struct(self, xmlSchemaElement, xelem); QNIL_OR_STRING(xelem->name) } |
#namespace ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 18 static VALUE rxml_schema_element_namespace(VALUE self) { xmlSchemaElementPtr xelem; Data_Get_Struct(self, xmlSchemaElement, xelem); QNIL_OR_STRING(xelem->targetNamespace) } |
#node ⇒ Object
49 50 51 52 53 54 55 56 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 49 static VALUE rxml_schema_element_node(VALUE self) { xmlSchemaElementPtr xelem; Data_Get_Struct(self, xmlSchemaElement, xelem); return rxml_node_wrap(xelem->node); } |
#required? ⇒ Boolean
6 7 8 |
# File 'lib/libxml/schema/element.rb', line 6 def required? !min_occurs.zero? end |
#type ⇒ Object
37 38 39 40 41 42 43 44 45 46 47 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 37 static VALUE rxml_schema_element_type(VALUE self) { xmlSchemaElementPtr xelem; xmlSchemaTypePtr xtype; Data_Get_Struct(self, xmlSchemaElement, xelem); xtype = xelem->subtypes; return rxml_wrap_schema_type((xmlSchemaTypePtr) xtype); } |
#value ⇒ Object
58 59 60 61 62 63 64 65 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 58 static VALUE rxml_schema_element_value(VALUE self) { xmlSchemaElementPtr xelem; Data_Get_Struct(self, xmlSchemaElement, xelem); QNIL_OR_STRING(xelem->value) } |