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

Changeset 1890

Show
Ignore:
Timestamp:
07/20/07 00:04:17 (1 year ago)
Author:
nahi
Message:
  • some WSDL caused cyclic schema inclusion. <xsd:import> supported cyclic include but <xsd:include> did not. extract common implementation as importHandler.rb. closes #385.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/wsdl/xmlSchema/import.rb

    r1824 r1890  
    99require 'wsdl/info' 
    1010require 'wsdl/xmlSchema/importer' 
     11require 'wsdl/xmlSchema/importHandler' 
    1112 
    1213 
     
    1718class Import < Info 
    1819  attr_reader :namespace 
    19   attr_reader :schemalocation 
    20   attr_reader :content 
    2120 
    2221  def initialize 
    2322    super 
    2423    @namespace = nil 
    25     @schemalocation = nil 
    26     @content = nil 
     24    @handler = ImportHandler.new 
     25  end 
     26 
     27  def schemalocation 
     28    @handler.schemalocation 
     29  end 
     30 
     31  def content 
     32    @handler.content 
    2733  end 
    2834 
     
    3642      @namespace = value.source 
    3743    when SchemaLocationAttrName 
    38       @schemalocation = URI.parse(value.source) 
    39       if @schemalocation.relative? and !parent.location.nil? and 
    40           !parent.location.relative? 
    41         @schemalocation = parent.location + @schemalocation 
    42       end 
    43       if root.importedschema.key?(@schemalocation) 
    44         @content = root.importedschema[@schemalocation] 
    45       else 
    46         root.importedschema[@schemalocation] = nil      # placeholder 
    47         @content = import(@schemalocation) 
    48         root.importedschema[@schemalocation] = @content 
    49       end 
    50       @schemalocation 
     44      @handler.parse_schemalocation(value.source, root, parent) 
    5145    else 
    5246      nil 
    5347    end 
    54   end 
    55  
    56 private 
    57  
    58   def import(location) 
    59     Importer.import(location, root) 
    6048  end 
    6149end 
  • trunk/lib/wsdl/xmlSchema/include.rb

    r1824 r1890  
    99require 'wsdl/info' 
    1010require 'wsdl/xmlSchema/importer' 
     11require 'wsdl/xmlSchema/importHandler' 
    1112 
    1213 
     
    1617 
    1718class Include < Info 
    18   attr_reader :schemalocation 
    19   attr_reader :content 
    20  
    2119  def initialize 
    2220    super 
    23     @schemalocation = nil 
    24     @content = nil 
     21    @handler = ImportHandler.new 
     22  end 
     23 
     24  def schemalocation 
     25    @handler.schemalocation 
     26  end 
     27 
     28  def content 
     29    @handler.content 
    2530  end 
    2631 
     
    3237    case attr 
    3338    when SchemaLocationAttrName 
    34       @schemalocation = URI.parse(value.source) 
    35       if @schemalocation.relative? 
    36         @schemalocation = parent.location + @schemalocation 
    37       end 
    38       @content = import(@schemalocation) 
    39       @schemalocation 
     39      @handler.parse_schemalocation(value.source, root, parent) 
    4040    else 
    4141      nil 
    4242    end 
    43   end 
    44  
    45 private 
    46  
    47   def import(location) 
    48     Importer.import(location) 
    4943  end 
    5044end