Class: WSDL::XMLSchema::ImportHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/wsdl/xmlSchema/importHandler.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeImportHandler

Returns a new instance of ImportHandler



21
22
23
24
# File 'lib/wsdl/xmlSchema/importHandler.rb', line 21

def initialize
  @schemalocation = nil
  @content = nil
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content



19
20
21
# File 'lib/wsdl/xmlSchema/importHandler.rb', line 19

def content
  @content
end

#schemalocationObject (readonly)

Returns the value of attribute schemalocation



18
19
20
# File 'lib/wsdl/xmlSchema/importHandler.rb', line 18

def schemalocation
  @schemalocation
end

Instance Method Details

#parse_schemalocation(location, root, parent) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/wsdl/xmlSchema/importHandler.rb', line 26

def parse_schemalocation(location, root, parent)
  @schemalocation = URI.parse(location)
  if @schemalocation.relative? and !parent.location.nil? and
      !parent.location.relative?
    @schemalocation = parent.location + @schemalocation
  end
  if root.importedschema.key?(@schemalocation)
    @content = root.importedschema[@schemalocation]
  else
    root.importedschema[@schemalocation] = nil      # placeholder
    @content = Importer.import(@schemalocation, root)
    root.importedschema[@schemalocation] = @content
  end
  @schemalocation
end