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 Method Summary collapse

Instance Method Details

#annotationObject



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'ext/libxml/ruby_xml_schema_element.c', line 67

static VALUE rxml_schema_element_annot(VALUE self)
{
	VALUE result = Qnil;
	xmlSchemaElementPtr xelem;

	Data_Get_Struct(self, xmlSchemaElement, xelem);

	if (xelem != NULL && xelem->annot != NULL && xelem->annot->content != NULL)
	{
		xmlChar *content = xmlNodeGetContent(xelem->annot->content);
		if (content)
		{
			result = rxml_new_cstr(content, NULL);
			xmlFree(content);
		}
	}
	return result;
}

#array?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/libxml/schema/element.rb', line 10

def array?
  max_occurs > 1
end

#elementsObject



14
15
16
# File 'lib/libxml/schema/element.rb', line 14

def elements
  type.elements
end

#nameObject



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

#namespaceObject



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

#nodeObject



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

Returns:

  • (Boolean)


6
7
8
# File 'lib/libxml/schema/element.rb', line 6

def required?
  !min_occurs.zero?
end

#typeObject



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);
}

#valueObject



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