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

Changeset 1947

Show
Ignore:
Timestamp:
09/09/07 17:19:28 (8 months ago)
Author:
nahi
Message:
  • XML encoding does not work properly depending on CES. Generator should use an escaping Regexp according to XSD::Charset.encoding. including cosmetic changes ("NONE" -> 'NONE') closes #417.
Files:

Legend:

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

    r1930 r1947  
    1010require 'soap/soap' 
    1111require 'xsd/codegen/gensupport' 
     12require 'soap/mapping/mapping' 
    1213 
    1314 
     
    10751076  end 
    10761077 
    1077   TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$'
     1078  TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$', nil, 'NONE'
    10781079 
    10791080  def self.parse_type(string) 
  • trunk/lib/soap/generator.rb

    r1945 r1947  
    5454    @buf = io || '' 
    5555    @indent = '' 
     56    @encode_char_regexp = 
     57      Regexp.new("[#{EncodeMap.keys.join}]", nil, XSD::Charset.encoding) 
    5658 
    5759    prologue 
     
    218220    "\r" => '
' 
    219221  } 
    220   EncodeCharRegexp = Regexp.new("[#{EncodeMap.keys.join}]") 
    221222  def encode_string(str) 
    222223    @buf << get_encoded(str) 
     
    225226  def get_encoded(str) 
    226227    if @use_numeric_character_reference and !XSD::Charset.is_us_ascii(str) 
    227       str.gsub!(EncodeCharRegexp) { |c| EncodeMap[c] } 
     228      str.gsub!(@encode_char_regexp) { |c| EncodeMap[c] } 
    228229      str.unpack("U*").collect { |c| 
    229230        if c == 0x9 or c == 0xa or c == 0xd or (c >= 0x20 and c <= 0x7f) 
     
    234235      }.join 
    235236    else 
    236       str.gsub(EncodeCharRegexp) { |c| EncodeMap[c] } 
     237      str.gsub(@encode_char_regexp) { |c| EncodeMap[c] } 
    237238    end 
    238239  end 
     
    267268  def find_handler(encodingstyle) 
    268269    unless @handlers.key?(encodingstyle) 
    269       handler = SOAP::EncodingStyle::Handler.handler(encodingstyle).new(@charset) 
    270       handler.generate_explicit_type = @generate_explicit_type 
    271       handler.encode_prologue 
    272       @handlers[encodingstyle] = handler 
     270      factory = SOAP::EncodingStyle::Handler.handler(encodingstyle) 
     271      if factory 
     272        handler = factory.new(@charset) 
     273        handler.generate_explicit_type = @generate_explicit_type 
     274        handler.encode_prologue 
     275        @handlers[encodingstyle] = handler 
     276      end 
    273277    end 
    274278    @handlers[encodingstyle] 
  • trunk/lib/xsd/charset.rb

    r1824 r1947  
    128128  # us_ascii = '[\x00-\x7F]' 
    129129  us_ascii = '[\x9\xa\xd\x20-\x7F]'     # XML 1.0 restricted. 
    130   USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z", nil, "NONE"
     130  USASCIIRegexp = Regexp.new("\\A#{us_ascii}*\\z", nil, 'NONE'
    131131 
    132132  twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])' 
    133133  threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])' 
    134134  character_euc = "(?:#{us_ascii}|#{twobytes_euc}|#{threebytes_euc})" 
    135   EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, "NONE"
     135  EUCRegexp = Regexp.new("\\A#{character_euc}*\\z", nil, 'NONE'
    136136 
    137137  # onebyte_sjis = '[\x00-\x7F\xA1-\xDF]' 
     
    139139  twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])' 
    140140  character_sjis = "(?:#{onebyte_sjis}|#{twobytes_sjis})" 
    141   SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, "NONE"
     141  SJISRegexp = Regexp.new("\\A#{character_sjis}*\\z", nil, 'NONE'
    142142 
    143143  # 0xxxxxxx 
     
    150150  character_utf8 = 
    151151    "(?:#{us_ascii}|#{twobytes_utf8}|#{threebytes_utf8}|#{fourbytes_utf8})" 
    152   UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, "NONE"
     152  UTF8Regexp = Regexp.new("\\A#{character_utf8}*\\z", nil, 'NONE'
    153153 
    154154  def Charset.is_us_ascii(str) 
  • trunk/lib/xsd/ns.rb

    r1898 r1947  
    107107 
    108108  # $1 and $2 are necessary. 
    109   ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z'
     109  ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z', nil, 'NONE'
    110110 
    111111  def parse(str, local = false) 
  • trunk/lib/xsd/xmlparser.rb

    r1824 r1947  
    2020 
    2121  # $1 is necessary. 
    22   NSParseRegexp = Regexp.new('^xmlns:?(.*)$'
     22  NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE'
    2323 
    2424  def filter_ns(ns, attrs)