summaryrefslogtreecommitdiff
path: root/lib/wsdl/xmlSchema/element.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl/xmlSchema/element.rb')
-rw-r--r--lib/wsdl/xmlSchema/element.rb45
1 files changed, 16 insertions, 29 deletions
diff --git a/lib/wsdl/xmlSchema/element.rb b/lib/wsdl/xmlSchema/element.rb
index 90e8c0d5d1..cc9d4e9ed8 100644
--- a/lib/wsdl/xmlSchema/element.rb
+++ b/lib/wsdl/xmlSchema/element.rb
@@ -28,8 +28,8 @@ class Element < Info
@type = type
@local_complextype = nil
@constraint = nil
- @maxoccurs = 1
- @minoccurs = 1
+ @maxoccurs = '1'
+ @minoccurs = '1'
@nillable = nil
end
@@ -37,6 +37,11 @@ class Element < Info
parent.targetnamespace
end
+ def elementform
+ # ToDo: must be overwritten.
+ parent.elementformdefault
+ end
+
def parse_element(element)
case element
when ComplexTypeName
@@ -54,45 +59,27 @@ class Element < Info
def parse_attr(attr, value)
case attr
when NameAttrName
- #@name = XSD::QName.new(nil, value)
- @name = XSD::QName.new(targetnamespace, value)
+ @name = XSD::QName.new(targetnamespace, value.source)
when TypeAttrName
- @type = if value.is_a?(XSD::QName)
- value
- else
- XSD::QName.new(XSD::Namespace, value)
- end
+ @type = value
when MaxOccursAttrName
- case parent
- when All
- if value != '1'
+ if parent.is_a?(All)
+ if value.source != '1'
raise Parser::AttrConstraintError.new(
"Cannot parse #{ value } for #{ attr }.")
end
- @maxoccurs = value
- when Sequence
- @maxoccurs = value
- else
- raise NotImplementedError.new
end
- @maxoccurs
+ @maxoccurs = value.source
when MinOccursAttrName
- case parent
- when All
- if ['0', '1'].include?(value)
- @minoccurs = value
- else
+ if parent.is_a?(All)
+ unless ['0', '1'].include?(value.source)
raise Parser::AttrConstraintError.new(
"Cannot parse #{ value } for #{ attr }.")
end
- when Sequence
- @minoccurs = value
- else
- raise NotImplementedError.new
end
- @minoccurs
+ @minoccurs = value.source
when NillableAttrName
- @nillable = (value == 'true')
+ @nillable = (value.source == 'true')
else
nil
end