Class: RubyXsd

Inherits:
Object
  • Object
show all
Extended by:
ClassMaker
Defined in:
lib/ruby-xsd.rb

Constant Summary

Constants included from ClassMaker

ClassMaker::XMLSchemaNS

Class Method Summary collapse

Methods included from ClassMaker

make_definition

Class Method Details

.models_from(xsd_definitions) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/ruby-xsd.rb', line 9

def models_from xsd_definitions
  doc = Nokogiri::XML xsd_definitions

  schema = doc.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