Changeset 1890
- Timestamp:
- 07/20/07 00:04:17 (1 year ago)
- Files:
-
- trunk/lib/wsdl/xmlSchema/import.rb (modified) (3 diffs)
- trunk/lib/wsdl/xmlSchema/importHandler.rb (added)
- trunk/lib/wsdl/xmlSchema/include.rb (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/wsdl/xmlSchema/import.rb
r1824 r1890 9 9 require 'wsdl/info' 10 10 require 'wsdl/xmlSchema/importer' 11 require 'wsdl/xmlSchema/importHandler' 11 12 12 13 … … 17 18 class Import < Info 18 19 attr_reader :namespace 19 attr_reader :schemalocation20 attr_reader :content21 20 22 21 def initialize 23 22 super 24 23 @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 27 33 end 28 34 … … 36 42 @namespace = value.source 37 43 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) 51 45 else 52 46 nil 53 47 end 54 end55 56 private57 58 def import(location)59 Importer.import(location, root)60 48 end 61 49 end trunk/lib/wsdl/xmlSchema/include.rb
r1824 r1890 9 9 require 'wsdl/info' 10 10 require 'wsdl/xmlSchema/importer' 11 require 'wsdl/xmlSchema/importHandler' 11 12 12 13 … … 16 17 17 18 class Include < Info 18 attr_reader :schemalocation19 attr_reader :content20 21 19 def initialize 22 20 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 25 30 end 26 31 … … 32 37 case attr 33 38 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) 40 40 else 41 41 nil 42 42 end 43 end44 45 private46 47 def import(location)48 Importer.import(location)49 43 end 50 44 end