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.



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

def initialize
  @schemalocation = nil
  @content = nil
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



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

def content
  @content
end

#schemalocationObject (readonly)

Returns the value of attribute schemalocation.



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

def schemalocation
  @schemalocation
end

Instance Method Details

#parse_schemalocation(location, root, parent) ⇒ Object



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

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