Class: Tiss::Convert

Inherits:
Object
  • Object
show all
Extended by:
ClassMaker
Defined in:
lib/xsd/convert.rb,
lib/tiss/xsd/convert.rb

Constant Summary

Constants included from ClassMaker

ClassMaker::XMLSchemaNS

Class Method Summary collapse

Methods included from ClassMaker

make_definition

Class Method Details

.models_from(version, xsd_definitions) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/xsd/convert.rb', line 11

def models_from(version, xsd_definitions)
  doc = Nokogiri::XML xsd_definitions
  @version = version

  children = doc.children.reject { |node| node.name == 'comment' }
  schema = children.first

  raise 'Invalid XMLSchema root' if schema.name != 'schema'
  raise 'Missing XMLSchema namespace' if schema.namespace.nil?
  raise 'Wrong XMLSchema namespace' unless is_xml_schema_node schema

  schema.children.each { |node| make_definition node }
end