Sha256: 6c12800fc269671081369e369135a7e2bb9a6c0a62e91e76360df6677cbc1725
Contents?: true
Size: 1011 Bytes
Versions: 1
Compression:
Stored size: 1011 Bytes
Contents
module XsdReader class Schema include Shared def schema return self end def target_namespace node && node.attributes['targetNamespace'] ? node.attributes['targetNamespace'].value : nil end def namespaces self.node ? self.node.namespaces : {} end def targets_namespace?(ns) target_namespace == ns || target_namespace == namespaces["xmlns:#{ns}"] end def imports @imports ||= map_children("import") end def mappable_children(xml_name) result = super result += import_mappable_children(xml_name) if xml_name != 'import' return result.to_a end def import_mappable_children(xml_name) self.imports.map{|import| import.reader.schema.mappable_children(xml_name)}.flatten end def import_by_namespace(ns) aliases = [ns, namespaces["xmlns:#{(ns || '').gsub(/^xmlns\:/, '')}"]].compact return imports.find{|import| aliases.include?(import.namespace)} end end # class Schema end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
xsd-reader-0.4.0 | lib/xsd_reader/schema.rb |