Class: WSDL::Import

Inherits:
Info
  • Object
show all
Defined in:
lib/wsdl/patch.rb

Instance Method Summary collapse

Instance Method Details

#parse_attr(attr, value) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/wsdl/patch.rb', line 5

def parse_attr(attr, value)
  case attr
  when NamespaceAttrName
    @namespace = value.source
    # if @content
    #   @content.targetnamespace = @namespace
    # end
    @namespace
  when LocationAttrName
    @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
    nil
  end
end