Sha256: 93e773ffcea4f174c9385e8be653e6ff4397120433bd85b88609707df7f72e56
Contents?: true
Size: 1.54 KB
Versions: 1
Compression:
Stored size: 1.54 KB
Contents
module XsdModel module Elements class Schema include BaseElement extend AttributeMethods attr_accessor :source attribute_method 'targetNamespace' def initialize(*args, attributes: {}, namespaces: {}, css_path: '') super @source = '(initial)' end def collect_imported_schemas(options = {}) _collect_imported_schemas(self, options) end def _collect_imported_schemas(original_schema, options, already_collected = []) imports = original_schema.imports imports.each do |import| unless already_collected.map { |d| d.target_namespace }.include? import.namespace new_schema = import.load(options) already_collected << new_schema _collect_imported_schemas(new_schema, options, already_collected) end end already_collected end def collect_included_schemas(options = {}) _collect_included_schemas(self, options) end def _collect_included_schemas(original_schema, options, collected_schemas = [], collected_paths = []) includes = original_schema.includes includes.each do |incl| unless collected_paths.include? incl.schema_location new_schema = incl.load(options) collected_schemas << new_schema collected_paths << incl.schema_location _collect_included_schemas(new_schema, options, collected_schemas, collected_paths) end end collected_schemas end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xsd_model-0.7.0 | lib/xsd_model/elements/schema.rb |