summaryrefslogtreecommitdiff
path: root/lib/wsdl/import.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wsdl/import.rb')
-rw-r--r--lib/wsdl/import.rb26
1 files changed, 18 insertions, 8 deletions
diff --git a/lib/wsdl/import.rb b/lib/wsdl/import.rb
index 706cb95fe2..faf60871a5 100644
--- a/lib/wsdl/import.rb
+++ b/lib/wsdl/import.rb
@@ -45,13 +45,23 @@ class Import < Info
end
@namespace
when LocationAttrName
- @location = value.source
- @content = import(@location)
- if @content.is_a?(Definitions)
- @content.root = root
- if @namespace
- @content.targetnamespace = @namespace
- end
+ @location = URI.parse(value.source)
+ if @location.relative? and !parent.location.nil? and
+ !parent.location.relative?
+ @location = parent.location + @location
+ end
+ if root.importedschema.key?(@location)
+ @content = root.importedschema[@location]
+ else
+ root.importedschema[@location] = nil # placeholder
+ @content = import(@location)
+ if @content.is_a?(Definitions)
+ @content.root = root
+ if @namespace
+ @content.targetnamespace = @namespace
+ end
+ end
+ root.importedschema[@location] = @content
end
@location
else
@@ -62,7 +72,7 @@ class Import < Info
private
def import(location)
- Importer.import(location)
+ Importer.import(location, root)
end
end