Changeset 1488
- Timestamp:
- 04/16/05 19:21:11 (4 years ago)
- Files:
-
- trunk/lib/soap/netHttpClient.rb (modified) (1 diff)
- trunk/lib/wsdl/definitions.rb (modified) (1 diff)
- trunk/lib/wsdl/import.rb (modified) (1 diff)
- trunk/lib/wsdl/importer.rb (modified) (1 diff)
- trunk/lib/wsdl/parser.rb (modified) (2 diffs)
- trunk/lib/wsdl/xmlSchema/import.rb (modified) (1 diff)
- trunk/lib/wsdl/xmlSchema/importer.rb (modified) (2 diffs)
- trunk/lib/wsdl/xmlSchema/parser.rb (modified) (2 diffs)
- trunk/lib/wsdl/xmlSchema/schema.rb (modified) (3 diffs)
- trunk/lib/wsdl/xmlSchema/xsd2ruby.rb (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/soap/netHttpClient.rb
r1383 r1488 97 97 98 98 def get_content(url, header = {}) 99 url = URI.parse(url) 99 unless url.is_a?(URI) 100 url = URI.parse(url) 101 end 100 102 extra = header.dup 101 103 extra['User-Agent'] = @agent if @agent trunk/lib/wsdl/definitions.rb
r1416 r1488 19 19 attr_reader :imports 20 20 21 attr_accessor :location 22 21 23 def initialize 22 24 super 23 25 @name = nil 24 26 @targetnamespace = nil 27 @location = nil 25 28 @types = nil 26 29 @imports = [] trunk/lib/wsdl/import.rb
r1369 r1488 46 46 @namespace 47 47 when LocationAttrName 48 @location = value.source 48 @location = URI.parse(value.source) 49 if @location.relative? 50 @location = parent.location + @location 51 end 49 52 @content = import(@location) 50 53 if @content.is_a?(Definitions) trunk/lib/wsdl/importer.rb
r1422 r1488 21 21 private 22 22 23 def parse(content )23 def parse(content, location) 24 24 begin 25 WSDL::Parser.new({ }).parse(content)25 WSDL::Parser.new({:location => location}).parse(content) 26 26 rescue WSDL::Parser::ParseError 27 super(content )27 super(content, location) 28 28 end 29 29 end trunk/lib/wsdl/parser.rb
r1421 r1488 55 55 @lastnode = nil 56 56 @ignored = {} 57 @location = opt[:location] 57 58 end 58 59 … … 112 113 if elename == DefinitionsName 113 114 o = Definitions.parse_element(elename) 115 o.location = @location 116 o 114 117 else 115 118 raise UnknownElementError.new("unknown element: #{elename}") trunk/lib/wsdl/xmlSchema/import.rb
r1475 r1488 36 36 @namespace = value.source 37 37 when SchemaLocationAttrName 38 @schemalocation = value.source 38 @schemalocation = URI.parse(value.source) 39 if @schemalocation.relative? 40 @schemalocation = parent.location + @schemalocation 41 end 39 42 @content = import(@schemalocation) 40 43 @schemalocation trunk/lib/wsdl/xmlSchema/importer.rb
r1422 r1488 25 25 26 26 def import(location) 27 parse(fetch(location)) 27 unless location.is_a?(URI) 28 location = URI.parse(location) 29 end 30 content = parse(fetch(location), location) 31 content.location = location 32 content 28 33 end 29 34 30 35 private 31 36 32 def parse(content )33 WSDL::XMLSchema::Parser.new({ }).parse(content)37 def parse(content, location) 38 WSDL::XMLSchema::Parser.new({:location => location}).parse(content) 34 39 end 35 40 … … 37 42 STDERR.puts("importing: #{location}") if $DEBUG 38 43 content = nil 39 if FileTest.exist?(location) 40 content = File.open(location).read 44 if location.scheme == 'file' or 45 (location.relative? and FileTest.exist?(location.path)) 46 content = File.open(location.path).read 41 47 else 42 48 client = web_client.new(nil, "WSDL4R") trunk/lib/wsdl/xmlSchema/parser.rb
r1483 r1488 53 53 @lastnode = nil 54 54 @ignored = {} 55 @location = opt[:location] 55 56 end 56 57 … … 110 111 if elename == SchemaName 111 112 o = Schema.parse_element(elename) 113 o.location = @location 114 o 112 115 else 113 116 raise UnknownElementError.new("unknown element: #{elename}") trunk/lib/wsdl/xmlSchema/schema.rb
r1475 r1488 25 25 attr_accessor :elementformdefault 26 26 27 attr_accessor :location 28 27 29 def initialize 28 30 super … … 34 36 @imports = [] 35 37 @elementformdefault = "qualified" 38 @location = nil 36 39 @root = self 37 40 end … … 41 44 when ImportName 42 45 o = Import.new 46 @imports << o 47 o 48 when IncludeName 49 o = Include.new 43 50 @imports << o 44 51 o trunk/lib/wsdl/xmlSchema/xsd2ruby.rb
r1437 r1488 87 87 88 88 def create_classname(xsd) 89 name = xsd.targetnamespace.scan(/[a-zA-Z0-9]+$/)[0] 89 name = nil 90 if xsd.targetnamespace 91 name = xsd.targetnamespace.scan(/[a-zA-Z0-9]+$/)[0] 92 end 90 93 if name.nil? 91 94 'default'