Changeset 1622
- Timestamp:
- 09/13/05 23:29:50 (3 years ago)
- Files:
-
- trunk/lib/soap/generator.rb (modified) (3 diffs)
- trunk/lib/soap/mapping/wsdlencodedregistry.rb (modified) (1 diff)
- trunk/lib/soap/rpc/proxy.rb (modified) (1 diff)
- trunk/sample/wsdl/googleSearch/wsdlDriver.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/generator.rb
r1604 r1622 29 29 attr_accessor :default_encodingstyle 30 30 attr_accessor :generate_explicit_type 31 attr_accessor :use_numeric_character_reference 31 32 32 33 def initialize(opt = {}) … … 39 40 @elementformdefault = opt[:elementformdefault] 40 41 @attributeformdefault = opt[:attributeformdefault] 42 @use_numeric_character_reference = opt[:use_numeric_character_reference] 41 43 @indentstr = opt[:no_indent] ? '' : ' ' 42 44 @buf = @indent = @curr = nil … … 191 193 EncodeCharRegexp = Regexp.new("[#{EncodeMap.keys.join}]") 192 194 def encode_string(str) 193 @buf << str.gsub(EncodeCharRegexp) { |c| EncodeMap[c] } 195 if @use_numeric_character_reference and !XSD::Charset.is_us_ascii(str) 196 str.gsub!(EncodeCharRegexp) { |c| EncodeMap[c] } 197 @buf << str.unpack("U*").collect { |c| 198 if c == 0x9 or c == 0xa or c == 0xd or (c >= 0x20 and c <= 0x7f) 199 c.chr 200 else 201 sprintf("&#x%x;", c) 202 end 203 }.join 204 else 205 @buf << str.gsub(EncodeCharRegexp) { |c| EncodeMap[c] } 206 end 194 207 end 195 208 trunk/lib/soap/mapping/wsdlencodedregistry.rb
r1597 r1622 150 150 soap_obj = nil 151 151 if type <= XSD::XSDString 152 str = XSD::Charset.encoding_conv(obj , Thread.current[:SOAPExternalCES],153 XSD::Charset.encoding)152 str = XSD::Charset.encoding_conv(obj.to_s, 153 Thread.current[:SOAPExternalCES], XSD::Charset.encoding) 154 154 soap_obj = type.new(str) 155 155 mark_marshalled_obj(obj, soap_obj) trunk/lib/soap/rpc/proxy.rb
r1618 r1622 255 255 opt[:generate_explicit_type] = @generate_explicit_type 256 256 opt[:no_indent] = @options["soap.envelope.no_indent"] 257 opt[:use_numeric_character_reference] = 258 @options["soap.envelope.use_numeric_character_reference"] 257 259 opt.update(hash) if hash 258 260 opt trunk/sample/wsdl/googleSearch/wsdlDriver.rb
r1619 r1622 15 15 16 16 google = SOAP::WSDLDriverFactory.new(GOOGLE_WSDL).create_rpc_driver 17 google.options["soap.envelope.use_numeric_character_reference"] = true 17 18 google.wiredump_dev = STDOUT if $DEBUG 18 19 #google.generate_explicit_type = false