From dea5606f8ce71f83b49c1dbde5585c4f9bc6f6f5 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner Date: Wed, 23 Apr 2014 08:41:01 +0200 Subject: [PATCH] process xsd inidcators for nested complex types --- lib/wasabi/parser.rb | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/wasabi/parser.rb b/lib/wasabi/parser.rb index 497487d..5add77a 100644 --- a/lib/wasabi/parser.rb +++ b/lib/wasabi/parser.rb @@ -183,12 +183,7 @@ def process_type(namespace, type, name) element_name = inner.attribute('name').to_s @types[name][element_name] = { :type => inner.attribute('type').to_s } - [ :nillable, :minOccurs, :maxOccurs ].each do |attr| - if v = inner.attribute(attr.to_s) - @types[name][element_name][attr] = v.to_s - end - end - + parse_indicators(namespace,element_name,inner) @types[name][:order!] << element_name end @@ -196,6 +191,7 @@ def process_type(namespace, type, name) element_name = inner_element.attribute('name').to_s @types[name][element_name] = { :type => inner_element.attribute('type').to_s } + parse_indicators(namespace,element_name,inner_element) @types[name][:order!] << element_name end @@ -314,5 +310,17 @@ def sections @sections = sections end + + private + + # parse XSD indicators + def parse_indicators(name,element_name,inner_xml) + + [ :nillable, :minOccurs, :maxOccurs ].each do |attr| + if v = inner_xml.attribute(attr.to_s) + @types[name][element_name][attr] = v.to_s + end + end + end end end