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

root/branches/1_5/lib/wsdl/xmlSchema/importHandler.rb

Revision 1890, 1.1 kB (checked in by nahi, 1 year ago)
  • some WSDL caused cyclic schema inclusion. <xsd:import> supported cyclic include but <xsd:include> did not. extract common implementation as importHandler.rb. closes #385.
Line 
1 # WSDL4R - XMLSchema import handler.
2 # Copyright (C) 2000-2007  NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
4 # This program is copyrighted free software by NAKAMURA, Hiroshi.  You can
5 # redistribute it and/or modify it under the same terms of Ruby's license;
6 # either the dual license version in 2003, or any later version.
7
8
9 require 'wsdl/info'
10 require 'wsdl/xmlSchema/importer'
11
12
13 module WSDL
14 module XMLSchema
15
16
17 class ImportHandler
18   attr_reader :schemalocation
19   attr_reader :content
20
21   def initialize
22     @schemalocation = nil
23     @content = nil
24   end
25
26   def parse_schemalocation(location, root, parent)
27     @schemalocation = URI.parse(location)
28     if @schemalocation.relative? and !parent.location.nil? and
29         !parent.location.relative?
30       @schemalocation = parent.location + @schemalocation
31     end
32     if root.importedschema.key?(@schemalocation)
33       @content = root.importedschema[@schemalocation]
34     else
35       root.importedschema[@schemalocation] = nil      # placeholder
36       @content = Importer.import(@schemalocation, root)
37       root.importedschema[@schemalocation] = @content
38     end
39     @schemalocation
40   end
41 end
42
43
44 end
45 end
Note: See TracBrowser for help on using the browser.