Class: LibXML::XML::Schema::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/libxml/schema/element.rb,
ext/libxml/ruby_xml_schema_element.c

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject (readonly)

#namespaceObject (readonly)

#typeObject (readonly)

#valueObject (readonly)

Instance Method Details

#annotationObject



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).

Returns:

  • (Boolean)


34
35
36
# File 'lib/libxml/schema/element.rb', line 34

def array?
  max_occurs > 1
end

#elementsObject

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_occursObject

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_occursObject

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

#nodeObject



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).

Returns:

  • (Boolean)


26
27
28
# File 'lib/libxml/schema/element.rb', line 26

def required?
  !min_occurs.zero?
end