Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Changeset 101

Show
Ignore:
Timestamp:
05/24/01 22:35:47 (8 years ago)
Author:
nakahiro
Message:

Extracted literals from code.
Corrected whitespace chars. handling.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/soap/encodingStyleHandlerDynamic.rb

    r81 r101  
    3434 
    3535    class SOAPUnknown < SOAPTemporalObject 
     36      attr_accessor :textBuf 
     37 
    3638      def initialize( handler, ns, entity, typeNamespace, typeName ) 
    3739        super() 
     40        @textBuf = '' 
    3841        @handler = handler 
    3942        @ns = ns 
     
    129132 
    130133    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 
    132137        SOAPInt.decode( ns, entity ) 
    133       elsif typeNameString == 'integer' 
     138      elsif typeNameString == XSD::IntegerLiteral 
    134139        SOAPInteger.decode( ns, entity ) 
    135       elsif typeNameString == 'float' 
     140      elsif typeNameString == XSD::FloatLiteral 
    136141        SOAPFloat.decode( ns, entity ) 
    137       elsif typeNameString == 'boolean' 
     142      elsif typeNameString == XSD::BooleanLiteral 
    138143        SOAPBoolean.decode( ns, entity ) 
    139       elsif typeNameString == 'string' 
     144      elsif typeNameString == XSD::StringLiteral 
    140145        SOAPString.decode( ns, entity ) 
    141       elsif typeNameString == 'dateTime' 
     146      elsif typeNameString == XSD::DateTimeLiteral 
    142147        SOAPDateTime.decode( ns, entity ) 
    143       elsif typeNameString == 'base64Binary' 
     148      elsif typeNameString == XSD::Base64BinaryLiteral 
    144149        SOAPBase64.decode( ns, entity ) 
    145150      else 
     
    149154 
    150155    def decodeTagAsSOAPENC( ns, typeNameString, entity ) 
    151       if typeNameString == 'int' 
     156      if typeNameString == XSD::IntLiteral 
    152157        SOAPInt.decode( ns, entity ) 
    153       elsif typeNameString == 'integer' 
     158      elsif typeNameString == XSD::IntegerLiteral 
    154159        SOAPInteger.decode( ns, entity ) 
    155       elsif typeNameString == 'float' 
     160      elsif typeNameString == XSD::FloatLiteral 
    156161        SOAPFloat.decode( ns, entity ) 
    157       elsif typeNameString == 'boolean' 
     162      elsif typeNameString == XSD::BooleanLiteral 
    158163        SOAPBoolean.decode( ns, entity ) 
    159       elsif typeNameString == 'string' 
     164      elsif typeNameString == XSD::StringLiteral 
    160165        SOAPString.decode( ns, entity ) 
    161       elsif typeNameString == 'dateTime' 
     166      elsif typeNameString == XSD::DateTimeLiteral 
    162167        SOAPDateTime.decode( ns, entity ) 
    163       elsif typeNameString == 'base64' 
     168      elsif typeNameString == SOAP::Base64Literal 
    164169        SOAPBase64.decode( ns, entity ) 
    165170      else 
     
    169174 
    170175    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 
    173188      end 
    174189    end 
     
    176191    def decodeText( ns, entity, parent ) 
    177192      case parent.node 
     193      when SOAPUnknown 
     194        parent.node.textBuf << entity.text 
    178195      when XSDBase64Binary 
    179196        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 
    188198        parent.node.set( entity.text ) 
     199      else 
     200        # Nothing to do... 
    189201      end 
    190202    end 
  • trunk/lib/soap/parser.rb

    r79 r101  
    236236    handler = SOAP::EncodingStyleHandler.getHandler( encodingStyle ) 
    237237 
    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 ) 
    245243    end 
    246244  end