Changeset 101
- Timestamp:
- 05/24/01 22:35:47 (8 years ago)
- Files:
-
- trunk/lib/soap/encodingStyleHandlerDynamic.rb (modified) (5 diffs)
- trunk/lib/soap/parser.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/encodingStyleHandlerDynamic.rb
r81 r101 34 34 35 35 class SOAPUnknown < SOAPTemporalObject 36 attr_accessor :textBuf 37 36 38 def initialize( handler, ns, entity, typeNamespace, typeName ) 37 39 super() 40 @textBuf = '' 38 41 @handler = handler 39 42 @ns = ns … … 129 132 130 133 def decodeTagAsXSD( ns, typeNameString, entity ) 131 if typeNameString == 'int' 134 if typeNameString == XSD::AnyTypeLiteral 135 SOAPUnknown.new( self, ns, entity, XSD::Namespace, typeNameString ) 136 elsif typeNameString == XSD::IntLiteral 132 137 SOAPInt.decode( ns, entity ) 133 elsif typeNameString == 'integer'138 elsif typeNameString == XSD::IntegerLiteral 134 139 SOAPInteger.decode( ns, entity ) 135 elsif typeNameString == 'float'140 elsif typeNameString == XSD::FloatLiteral 136 141 SOAPFloat.decode( ns, entity ) 137 elsif typeNameString == 'boolean'142 elsif typeNameString == XSD::BooleanLiteral 138 143 SOAPBoolean.decode( ns, entity ) 139 elsif typeNameString == 'string'144 elsif typeNameString == XSD::StringLiteral 140 145 SOAPString.decode( ns, entity ) 141 elsif typeNameString == 'dateTime'146 elsif typeNameString == XSD::DateTimeLiteral 142 147 SOAPDateTime.decode( ns, entity ) 143 elsif typeNameString == 'base64Binary'148 elsif typeNameString == XSD::Base64BinaryLiteral 144 149 SOAPBase64.decode( ns, entity ) 145 150 else … … 149 154 150 155 def decodeTagAsSOAPENC( ns, typeNameString, entity ) 151 if typeNameString == 'int'156 if typeNameString == XSD::IntLiteral 152 157 SOAPInt.decode( ns, entity ) 153 elsif typeNameString == 'integer'158 elsif typeNameString == XSD::IntegerLiteral 154 159 SOAPInteger.decode( ns, entity ) 155 elsif typeNameString == 'float'160 elsif typeNameString == XSD::FloatLiteral 156 161 SOAPFloat.decode( ns, entity ) 157 elsif typeNameString == 'boolean'162 elsif typeNameString == XSD::BooleanLiteral 158 163 SOAPBoolean.decode( ns, entity ) 159 elsif typeNameString == 'string'164 elsif typeNameString == XSD::StringLiteral 160 165 SOAPString.decode( ns, entity ) 161 elsif typeNameString == 'dateTime'166 elsif typeNameString == XSD::DateTimeLiteral 162 167 SOAPDateTime.decode( ns, entity ) 163 elsif typeNameString == 'base64'168 elsif typeNameString == SOAP::Base64Literal 164 169 SOAPBase64.decode( ns, entity ) 165 170 else … … 169 174 170 175 def decodeTagEnd( ns, node ) 171 if node.node.is_a?( SOAPUnknown ) 172 node.node.toStruct 176 o = node.node 177 if o.is_a?( SOAPUnknown ) 178 if /\A\s*\z/ =~ o.textBuf 179 o.toStruct 180 else 181 newNode = o.toString 182 if newNode.id 183 @idPool << newParent 184 end 185 node.replaceNode( newNode ) 186 node.node.set( o.textBuf ) 187 end 173 188 end 174 189 end … … 176 191 def decodeText( ns, entity, parent ) 177 192 case parent.node 193 when SOAPUnknown 194 parent.node.textBuf << entity.text 178 195 when XSDBase64Binary 179 196 parent.node.setEncoded( entity.text ) 180 when SOAPUnknown 181 newParent = parent.node.toString 182 if newParent.id 183 @idPool << newParent 184 end 185 parent.replaceNode( newParent ) 186 parent.node.set( entity.text ) 187 else 197 when SOAPBasetype 188 198 parent.node.set( entity.text ) 199 else 200 # Nothing to do... 189 201 end 190 202 end trunk/lib/soap/parser.rb
r79 r101 236 236 handler = SOAP::EncodingStyleHandler.getHandler( encodingStyle ) 237 237 238 unless /\A[\r\n\s]+\z/ =~ entity.text # Ad-hoc... 239 if handler 240 handler.decodeText( ns, entity, parent ) 241 else 242 # Try to only set text... 243 parent.node.set( entity.text ) 244 end 238 if handler 239 handler.decodeText( ns, entity, parent ) 240 else 241 # How should I do? 242 # parent.node.set( entity.text ) 245 243 end 246 244 end