From e5a3aba50e2bd7e0327aacd8fe1ab7963fc4a007 Mon Sep 17 00:00:00 2001 From: nahi Date: Mon, 20 Dec 2004 13:50:15 +0000 Subject: * added files: * lib/soap/mapping/wsdl*.rb * lib/wsdl/soap/element.rb * lib/wsdl/xmlSchema/simpleContent.rb * modified files: * lib/soap/* * lib/wsdl/* * lib/xsd/* * test/soap/* * test/wsdl/* * test/xsd/* * summary * imported from the soap4r repository. Version: 1.5.3-ruby1.8.2 * added several XSD basetype support: nonPositiveInteger, negativeInteger, nonNegativeInteger, unsignedLong, unsignedInt, unsignedShort, unsignedByte, positiveInteger * HTTP client connection/send/receive timeout support. * HTTP client/server gzipped content encoding support. * improved WSDL schema definition support; still is far from complete, but is making step by step improovement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/wsdl/xmlSchema/element.rb | 45 +++++++++++++++---------------------------- 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'lib/wsdl/xmlSchema/element.rb') 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 -- cgit v1.2.3