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 Attribute Summary collapse
- #name ⇒ Object readonly
- #namespace ⇒ Object readonly
- #type ⇒ Object readonly
- #value ⇒ Object readonly
Instance Method Summary collapse
- #annotation ⇒ Object
-
#array? ⇒ Boolean
call-seq: element.array? -> true or false.
-
#elements ⇒ Object
call-seq: element.elements -> Hash.
-
#max_occurs ⇒ Object
call-seq: element.max_occurs -> Integer.
-
#min_occurs ⇒ Object
call-seq: element.min_occurs -> Integer.
- #node ⇒ Object
-
#required? ⇒ Boolean
call-seq: element.required? -> true or false.
Instance Attribute Details
#name ⇒ Object (readonly)
#namespace ⇒ Object (readonly)
#type ⇒ Object (readonly)
#value ⇒ Object (readonly)
Instance Method Details
#annotation ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 39
static VALUE rxml_schema_element_annot(VALUE self)
{
xmlSchemaElementPtr xelem;
VALUE annotation = Qnil;
TypedData_Get_Struct(self, xmlSchemaElement, &rxml_schema_element_type, xelem);
if ((xelem->annot != NULL) && (xelem->annot->content != NULL))
{
xmlChar *content = xmlNodeGetContent(xelem->annot->content);
if (content)
{
annotation = rxml_new_cstr(content, NULL);
xmlFree(content);
}
}
return annotation;
}
|
#array? ⇒ Boolean
call-seq:
element.array? -> true or false
Returns whether this element can appear more than once (max_occurs > 1).
34 35 36 |
# File 'lib/libxml/schema/element.rb', line 34 def array? max_occurs > 1 end |
#elements ⇒ Object
call-seq:
element.elements -> Hash
Returns the child elements of this element’s type.
42 43 44 |
# File 'lib/libxml/schema/element.rb', line 42 def elements type.elements end |
#max_occurs ⇒ Object
call-seq:
element.max_occurs -> Integer
Returns the maximum number of times this element may appear.
18 19 20 |
# File 'lib/libxml/schema/element.rb', line 18 def max_occurs @max end |
#min_occurs ⇒ Object
call-seq:
element.min_occurs -> Integer
Returns the minimum number of times this element must appear.
10 11 12 |
# File 'lib/libxml/schema/element.rb', line 10 def min_occurs @min end |
#node ⇒ Object
30 31 32 33 34 35 36 37 |
# File 'ext/libxml/ruby_xml_schema_element.c', line 30
static VALUE rxml_schema_element_node(VALUE self)
{
xmlSchemaElementPtr xelem;
TypedData_Get_Struct(self, xmlSchemaElement, &rxml_schema_element_type, xelem);
return rxml_node_wrap(xelem->node);
}
|
#required? ⇒ Boolean
call-seq:
element.required? -> true or false
Returns whether this element is required (min_occurs > 0).
26 27 28 |
# File 'lib/libxml/schema/element.rb', line 26 def required? !min_occurs.zero? end |