Changeset 1947
- Timestamp:
- 09/09/07 17:19:28 (8 months ago)
- Files:
-
- trunk/lib/soap/baseData.rb (modified) (2 diffs)
- trunk/lib/soap/generator.rb (modified) (5 diffs)
- trunk/lib/xsd/charset.rb (modified) (3 diffs)
- trunk/lib/xsd/ns.rb (modified) (1 diff)
- trunk/lib/xsd/xmlparser.rb (modified) (1 diff)
- trunk/test/soap/test_generator.rb (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/baseData.rb
r1930 r1947 10 10 require 'soap/soap' 11 11 require 'xsd/codegen/gensupport' 12 require 'soap/mapping/mapping' 12 13 13 14 … … 1075 1076 end 1076 1077 1077 TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$' )1078 TypeParseRegexp = Regexp.new('^(.+)\[([\d,]*)\]$', nil, 'NONE') 1078 1079 1079 1080 def self.parse_type(string) trunk/lib/soap/generator.rb
r1945 r1947 54 54 @buf = io || '' 55 55 @indent = '' 56 @encode_char_regexp = 57 Regexp.new("[#{EncodeMap.keys.join}]", nil, XSD::Charset.encoding) 56 58 57 59 prologue … … 218 220 "\r" => '
' 219 221 } 220 EncodeCharRegexp = Regexp.new("[#{EncodeMap.keys.join}]")221 222 def encode_string(str) 222 223 @buf << get_encoded(str) … … 225 226 def get_encoded(str) 226 227 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] } 228 229 str.unpack("U*").collect { |c| 229 230 if c == 0x9 or c == 0xa or c == 0xd or (c >= 0x20 and c <= 0x7f) … … 234 235 }.join 235 236 else 236 str.gsub( EncodeCharRegexp) { |c| EncodeMap[c] }237 str.gsub(@encode_char_regexp) { |c| EncodeMap[c] } 237 238 end 238 239 end … … 267 268 def find_handler(encodingstyle) 268 269 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 273 277 end 274 278 @handlers[encodingstyle] trunk/lib/xsd/charset.rb
r1824 r1947 128 128 # us_ascii = '[\x00-\x7F]' 129 129 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') 131 131 132 132 twobytes_euc = '(?:[\x8E\xA1-\xFE][\xA1-\xFE])' 133 133 threebytes_euc = '(?:\x8F[\xA1-\xFE][\xA1-\xFE])' 134 134 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') 136 136 137 137 # onebyte_sjis = '[\x00-\x7F\xA1-\xDF]' … … 139 139 twobytes_sjis = '(?:[\x81-\x9F\xE0-\xFC][\x40-\x7E\x80-\xFC])' 140 140 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') 142 142 143 143 # 0xxxxxxx … … 150 150 character_utf8 = 151 151 "(?:#{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') 153 153 154 154 def Charset.is_us_ascii(str) trunk/lib/xsd/ns.rb
r1898 r1947 107 107 108 108 # $1 and $2 are necessary. 109 ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z' )109 ParseRegexp = Regexp.new('\A([^:]+)(?::(.+))?\z', nil, 'NONE') 110 110 111 111 def parse(str, local = false) trunk/lib/xsd/xmlparser.rb
r1824 r1947 20 20 21 21 # $1 is necessary. 22 NSParseRegexp = Regexp.new('^xmlns:?(.*)$' )22 NSParseRegexp = Regexp.new('^xmlns:?(.*)$', nil, 'NONE') 23 23 24 24 def filter_ns(ns, attrs)