9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/ruby-xsd/class_maker.rb', line 9
def make_definition node, target=Object
return if is_text node
attrs = node.attributes.to_hash
name = attrs["name"].value
if is_element node
type = attrs["type"].value if attrs.has_key? "type"
if type.nil?
complex_node = select_children(node, "complexType").first
define_class name, complex_node, target
else
attr_accessor name
end
elsif is_simple node
if not name.nil?
restrictions = select_children(node, "restriction").first
define_validator name, restrictions, target
end
elsif is_complex_root node
define_class name, node, target
end
end
|