schematic 0.6.2 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +14 -8
- data/.travis.yml +17 -0
- data/Gemfile +6 -1
- data/LICENSE +1 -1
- data/README.md +106 -0
- data/Rakefile +3 -8
- data/lib/schematic.rb +3 -42
- data/lib/schematic/exceptions.rb +13 -0
- data/lib/schematic/generator/column.rb +17 -11
- data/lib/schematic/generator/namespaces.rb +3 -3
- data/lib/schematic/generator/restrictions/base.rb +5 -5
- data/lib/schematic/generator/restrictions/custom.rb +3 -2
- data/lib/schematic/generator/restrictions/enumeration.rb +5 -2
- data/lib/schematic/generator/restrictions/length.rb +4 -2
- data/lib/schematic/generator/restrictions/numericality.rb +3 -1
- data/lib/schematic/generator/restrictions/pattern.rb +4 -3
- data/lib/schematic/generator/sandbox.rb +4 -1
- data/lib/schematic/generator/types.rb +14 -13
- data/lib/schematic/generator/uniqueness.rb +7 -8
- data/lib/schematic/generator/xsd.rb +32 -26
- data/lib/schematic/serializers/xsd.rb +6 -6
- data/lib/schematic/version.rb +1 -1
- data/schematic.gemspec +23 -24
- data/spec/schematic/generator/restrictions/custom_spec.rb +15 -18
- data/spec/schematic/generator/restrictions/enumeration_spec.rb +31 -31
- data/spec/schematic/generator/restrictions/length_spec.rb +35 -30
- data/spec/schematic/generator/restrictions/mixin_spec.rb +11 -15
- data/spec/schematic/generator/restrictions/numericality_spec.rb +11 -11
- data/spec/schematic/generator/restrictions/pattern_spec.rb +20 -21
- data/spec/schematic/generator/sandbox_spec.rb +17 -17
- data/spec/schematic/generator/uniqueness_spec.rb +38 -37
- data/spec/schematic/serializers/xsd_extend_spec.rb +11 -11
- data/spec/schematic/serializers/xsd_validation_presence_spec.rb +16 -11
- data/spec/schematic/serializers/xsd_xsd_ignore_methods_spec.rb +3 -3
- data/spec/schematic/serializers/xsd_xsd_methods_spec.rb +27 -24
- data/spec/schematic/serializers/xsd_xsd_minimum_occurrences_for_spec.rb +13 -8
- data/spec/schematic_serializers_xsd_spec.rb +70 -67
- data/spec/spec_helper.rb +8 -113
- data/spec/support/database.rb +9 -0
- data/spec/support/helpers.rb +111 -0
- data/spec/support/with_model.rb +5 -0
- data/spec/{xsd → support/xsd}/XMLSchema.xsd +0 -0
- data/spec/{xsd → support/xsd}/xml.xsd +0 -0
- metadata +54 -69
- data/.rspec +0 -1
- data/.rvmrc +0 -1
- data/README.rdoc +0 -103
- data/spec/support/extensions/active_model/validations/inclusion.rb +0 -69
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Schematic::Serializers::Xsd do
|
4
4
|
|
@@ -9,38 +9,43 @@ describe Schematic::Serializers::Xsd do
|
|
9
9
|
context "given a column with no validations" do
|
10
10
|
with_model :some_model do
|
11
11
|
table :id => false do |t|
|
12
|
-
t.string
|
12
|
+
t.string 'title'
|
13
|
+
end
|
14
|
+
|
15
|
+
model do
|
16
|
+
self.primary_key = :title
|
13
17
|
end
|
14
18
|
end
|
15
19
|
|
16
|
-
it {
|
20
|
+
it { is_expected.to eq(0) }
|
17
21
|
end
|
18
22
|
|
19
23
|
context "given a column with presence of but allow blank" do
|
20
24
|
with_model :some_model do
|
21
25
|
table :id => false do |t|
|
22
|
-
t.string
|
26
|
+
t.string 'title'
|
23
27
|
end
|
24
28
|
model do
|
29
|
+
self.primary_key = :title
|
25
30
|
validates :title, :presence => true, :allow_blank => true
|
26
31
|
end
|
27
32
|
end
|
28
33
|
|
29
|
-
it {
|
34
|
+
it { is_expected.to eq(0) }
|
30
35
|
end
|
31
36
|
|
32
37
|
context "given a column with presence of and no allow blank" do
|
33
38
|
with_model :some_model do
|
34
39
|
table :id => false do |t|
|
35
|
-
t.string
|
40
|
+
t.string 'title'
|
36
41
|
end
|
37
42
|
model do
|
43
|
+
self.primary_key = :title
|
38
44
|
validates :title, :presence => true
|
39
45
|
end
|
40
46
|
end
|
41
47
|
|
42
|
-
it {
|
48
|
+
it { is_expected.to eq(1) }
|
43
49
|
end
|
44
50
|
end
|
45
|
-
|
46
51
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Schematic::Serializers::Xsd do
|
4
4
|
before do
|
@@ -31,7 +31,6 @@ describe Schematic::Serializers::Xsd do
|
|
31
31
|
schematic do
|
32
32
|
add :foo
|
33
33
|
end
|
34
|
-
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
@@ -41,14 +40,14 @@ describe Schematic::Serializers::Xsd do
|
|
41
40
|
|
42
41
|
it "should validate against it's own XSD" do
|
43
42
|
invalid_instance = SomeClass.new
|
44
|
-
invalid_instance.attributes = {
|
43
|
+
invalid_instance.attributes = { 'bar' => 'foo' }
|
45
44
|
xml = [invalid_instance].to_xml
|
46
|
-
|
45
|
+
expect {
|
47
46
|
validate_xml_against_xsd(xml, subject)
|
48
|
-
}.
|
47
|
+
}.to raise_error
|
49
48
|
|
50
49
|
instance = SomeClass.new
|
51
|
-
instance.attributes = {
|
50
|
+
instance.attributes = { 'foo' => 'bar' }
|
52
51
|
xml = [instance].to_xml
|
53
52
|
validate_xml_against_xsd(xml, subject)
|
54
53
|
end
|
@@ -59,17 +58,19 @@ describe Schematic::Serializers::Xsd do
|
|
59
58
|
|
60
59
|
with_model :some_model do
|
61
60
|
table :id => false do |t|
|
62
|
-
t.string
|
63
|
-
t.text
|
64
|
-
t.float
|
65
|
-
t.integer
|
66
|
-
t.datetime
|
67
|
-
t.date
|
68
|
-
t.boolean
|
61
|
+
t.string 'some_string'
|
62
|
+
t.text 'some_text'
|
63
|
+
t.float 'some_float'
|
64
|
+
t.integer 'some_integer'
|
65
|
+
t.datetime 'some_datetime'
|
66
|
+
t.date 'some_date'
|
67
|
+
t.boolean 'some_boolean'
|
69
68
|
t.text "method_is_also_columns"
|
70
69
|
end
|
71
70
|
|
72
71
|
model do
|
72
|
+
self.primary_key = :some_string
|
73
|
+
|
73
74
|
validates :some_string, :presence => true, :length => { :maximum => 100 }
|
74
75
|
validates :some_text, :presence => true
|
75
76
|
validates :some_date, :presence => true, :allow_blank => true
|
@@ -93,14 +94,14 @@ describe Schematic::Serializers::Xsd do
|
|
93
94
|
end
|
94
95
|
|
95
96
|
it "should validate against it's own XSD" do
|
96
|
-
instance = SomeModel.new(:some_string =>
|
97
|
+
instance = SomeModel.new(:some_string => 'ExampleString',
|
97
98
|
:some_date => Date.today,
|
98
|
-
:some_text =>
|
99
|
+
:some_text => 'here is some text',
|
99
100
|
:some_datetime => DateTime.new,
|
100
101
|
:some_boolean => true,
|
101
102
|
:some_float => 1.5,
|
102
|
-
:method_is_also_columns => [
|
103
|
-
:additional_method_array => {
|
103
|
+
:method_is_also_columns => ['somevalues'],
|
104
|
+
:additional_method_array => {'somevalue' => 'somekey'},
|
104
105
|
:some_integer => 2)
|
105
106
|
xml = [instance].to_xml
|
106
107
|
validate_xml_against_xsd(xml, subject)
|
@@ -116,7 +117,7 @@ describe Schematic::Serializers::Xsd do
|
|
116
117
|
|
117
118
|
with_model :some_model do
|
118
119
|
table do |t|
|
119
|
-
t.string
|
120
|
+
t.string 'some_string'
|
120
121
|
end
|
121
122
|
|
122
123
|
model do
|
@@ -158,7 +159,7 @@ describe Schematic::Serializers::Xsd do
|
|
158
159
|
accepts_nested_attributes_for :parent
|
159
160
|
end
|
160
161
|
::Parent.class_eval do
|
161
|
-
has_many :children, :class_name =>
|
162
|
+
has_many :children, :class_name => 'Namespace::SubChild'
|
162
163
|
accepts_nested_attributes_for :children
|
163
164
|
end
|
164
165
|
end
|
@@ -170,16 +171,16 @@ describe Schematic::Serializers::Xsd do
|
|
170
171
|
child_instance = Namespace::SubChild.new(:parent_id => 123)
|
171
172
|
child_instance.save!
|
172
173
|
xml = [child_instance].to_xml
|
173
|
-
|
174
|
+
expect {
|
174
175
|
validate_xml_against_xsd(xml, subject)
|
175
|
-
}.
|
176
|
+
}.not_to raise_error
|
176
177
|
end
|
177
178
|
end
|
178
179
|
|
179
180
|
context "when the model has a nested attribute on a subclass with a different class name than the has_many association" do
|
180
181
|
with_model :parent2 do
|
181
182
|
model do
|
182
|
-
has_many :children, :class_name =>
|
183
|
+
has_many :children, :class_name => 'SpecialChild'
|
183
184
|
accepts_nested_attributes_for :children
|
184
185
|
end
|
185
186
|
end
|
@@ -197,8 +198,8 @@ describe Schematic::Serializers::Xsd do
|
|
197
198
|
subject { Parent2.to_xsd }
|
198
199
|
|
199
200
|
it "should generate a valid XSD" do
|
200
|
-
subject.
|
201
|
-
subject.
|
201
|
+
expect(subject).to include 'children-attributes'
|
202
|
+
expect(subject).not_to include 'special-children-attributes'
|
202
203
|
validate_xsd(subject)
|
203
204
|
end
|
204
205
|
end
|
@@ -224,9 +225,9 @@ describe Schematic::Serializers::Xsd do
|
|
224
225
|
subject { Car.to_xsd }
|
225
226
|
|
226
227
|
it "should generate a valid XSD" do
|
227
|
-
subject.
|
228
|
-
subject.
|
229
|
-
subject.
|
228
|
+
expect(subject).to include 'engine-attributes'
|
229
|
+
expect(subject).not_to include 'engines-attributes'
|
230
|
+
expect(subject).not_to include 'Engines'
|
230
231
|
validate_xsd(subject)
|
231
232
|
end
|
232
233
|
end
|
@@ -255,7 +256,7 @@ describe Schematic::Serializers::Xsd do
|
|
255
256
|
subject { Car.to_xsd }
|
256
257
|
|
257
258
|
it "should generate a valid XSD" do
|
258
|
-
subject.
|
259
|
+
expect(subject).not_to include 'engine-attributes'
|
259
260
|
validate_xsd(subject)
|
260
261
|
end
|
261
262
|
end
|
@@ -287,9 +288,9 @@ describe Schematic::Serializers::Xsd do
|
|
287
288
|
subject { Parent.to_xsd }
|
288
289
|
|
289
290
|
it "should be valid" do
|
290
|
-
subject.
|
291
|
-
subject.
|
292
|
-
subject.
|
291
|
+
expect(subject).to include 'child-attributes'
|
292
|
+
expect(subject).to include 'first-name'
|
293
|
+
expect(subject).not_to include 'last-name'
|
293
294
|
validate_xsd(subject)
|
294
295
|
end
|
295
296
|
end
|
@@ -298,8 +299,8 @@ describe Schematic::Serializers::Xsd do
|
|
298
299
|
subject { Child.to_xsd }
|
299
300
|
|
300
301
|
it "should be valid" do
|
301
|
-
subject.
|
302
|
-
subject.
|
302
|
+
expect(subject).to include 'first-name'
|
303
|
+
expect(subject).to include 'last-name'
|
303
304
|
validate_xsd(subject)
|
304
305
|
end
|
305
306
|
end
|
@@ -337,9 +338,9 @@ describe Schematic::Serializers::Xsd do
|
|
337
338
|
subject { Parent.to_xsd }
|
338
339
|
|
339
340
|
it "should be valid" do
|
340
|
-
subject.
|
341
|
-
subject.
|
342
|
-
subject.
|
341
|
+
expect(subject).to include 'child-attributes'
|
342
|
+
expect(subject).to include 'first-name'
|
343
|
+
expect(subject).to include 'last-name'
|
343
344
|
validate_xsd(subject)
|
344
345
|
end
|
345
346
|
end
|
@@ -348,8 +349,8 @@ describe Schematic::Serializers::Xsd do
|
|
348
349
|
subject { Child.to_xsd }
|
349
350
|
|
350
351
|
it "should be valid" do
|
351
|
-
subject.
|
352
|
-
subject.
|
352
|
+
expect(subject).to include 'first-name'
|
353
|
+
expect(subject).to include 'last-name'
|
353
354
|
validate_xsd(subject)
|
354
355
|
end
|
355
356
|
end
|
@@ -381,9 +382,9 @@ describe Schematic::Serializers::Xsd do
|
|
381
382
|
describe "the parent XSD" do
|
382
383
|
subject { Person.to_xsd }
|
383
384
|
it "should be valid" do
|
384
|
-
subject.
|
385
|
-
subject.
|
386
|
-
subject.
|
385
|
+
expect(subject).to include %q{"house-attributes"}
|
386
|
+
expect(subject).to include %q{"price"}
|
387
|
+
expect(subject).not_to include %q{"address"}
|
387
388
|
validate_xsd(subject)
|
388
389
|
end
|
389
390
|
end
|
@@ -391,8 +392,8 @@ describe Schematic::Serializers::Xsd do
|
|
391
392
|
describe "the child XSD" do
|
392
393
|
subject { House.to_xsd }
|
393
394
|
it "should be valid" do
|
394
|
-
subject.
|
395
|
-
subject.
|
395
|
+
expect(subject).to include %q{"price"}
|
396
|
+
expect(subject).to include %q{"address"}
|
396
397
|
validate_xsd(subject)
|
397
398
|
end
|
398
399
|
end
|
@@ -411,7 +412,7 @@ describe Schematic::Serializers::Xsd do
|
|
411
412
|
end
|
412
413
|
|
413
414
|
model do
|
414
|
-
belongs_to :university, class_name:
|
415
|
+
belongs_to :university, class_name: 'School'
|
415
416
|
|
416
417
|
accepts_nested_attributes_for :university
|
417
418
|
end
|
@@ -472,9 +473,9 @@ describe Schematic::Serializers::Xsd do
|
|
472
473
|
describe "the parent XSD" do
|
473
474
|
subject { Person.to_xsd }
|
474
475
|
it "should be valid" do
|
475
|
-
subject.
|
476
|
-
subject.
|
477
|
-
subject.
|
476
|
+
expect(subject).to include %q{"house-attributes"}
|
477
|
+
expect(subject).to include %q{"price"}
|
478
|
+
expect(subject).not_to include %q{"address"}
|
478
479
|
validate_xsd(subject)
|
479
480
|
end
|
480
481
|
end
|
@@ -482,8 +483,8 @@ describe Schematic::Serializers::Xsd do
|
|
482
483
|
describe "the child XSD" do
|
483
484
|
subject { House.to_xsd }
|
484
485
|
it "should be valid" do
|
485
|
-
subject.
|
486
|
-
subject.
|
486
|
+
expect(subject).to include %q{"price"}
|
487
|
+
expect(subject).to include %q{"address"}
|
487
488
|
validate_xsd(subject)
|
488
489
|
end
|
489
490
|
end
|
@@ -632,7 +633,7 @@ describe Schematic::Serializers::Xsd do
|
|
632
633
|
</xs:complexType>
|
633
634
|
</xs:schema>
|
634
635
|
XML
|
635
|
-
subject.
|
636
|
+
expect(subject).to eq(sanitize_xml(xsd))
|
636
637
|
end
|
637
638
|
|
638
639
|
end
|
@@ -646,6 +647,10 @@ describe Schematic::Serializers::Xsd do
|
|
646
647
|
table :id => false do |t|
|
647
648
|
t.float 'some_float'
|
648
649
|
end
|
650
|
+
|
651
|
+
model do
|
652
|
+
self.primary_key = :some_float
|
653
|
+
end
|
649
654
|
end
|
650
655
|
|
651
656
|
it "should define the correct xsd element" do
|
@@ -662,7 +667,7 @@ describe Schematic::Serializers::Xsd do
|
|
662
667
|
XML
|
663
668
|
end
|
664
669
|
|
665
|
-
subject.
|
670
|
+
expect(subject).to eq(xsd)
|
666
671
|
end
|
667
672
|
|
668
673
|
end
|
@@ -693,7 +698,7 @@ describe Schematic::Serializers::Xsd do
|
|
693
698
|
XML
|
694
699
|
end
|
695
700
|
|
696
|
-
sanitize_xml(SomeModel.to_xsd(:methods => {:foo_bar => nil})).
|
701
|
+
expect(sanitize_xml(SomeModel.to_xsd(:methods => {:foo_bar => nil}))).to eq(xsd)
|
697
702
|
end
|
698
703
|
end
|
699
704
|
|
@@ -703,7 +708,7 @@ describe Schematic::Serializers::Xsd do
|
|
703
708
|
with_model :ModelWithDifferentRoot do
|
704
709
|
model do
|
705
710
|
schematic do
|
706
|
-
root
|
711
|
+
root 'my_root'
|
707
712
|
end
|
708
713
|
end
|
709
714
|
end
|
@@ -711,10 +716,10 @@ describe Schematic::Serializers::Xsd do
|
|
711
716
|
subject { ModelWithDifferentRoot.to_xsd }
|
712
717
|
|
713
718
|
it "should use the new root tag name" do
|
714
|
-
subject.
|
715
|
-
subject.
|
716
|
-
subject.
|
717
|
-
subject.
|
719
|
+
expect(subject).not_to include %q{"model-with-different-root"}
|
720
|
+
expect(subject).not_to include %q{"model-with-different-roots"}
|
721
|
+
expect(subject).to include %q{"my-root"}
|
722
|
+
expect(subject).to include %q{"my-roots"}
|
718
723
|
validate_xsd(subject)
|
719
724
|
end
|
720
725
|
end
|
@@ -724,26 +729,26 @@ describe Schematic::Serializers::Xsd do
|
|
724
729
|
describe "#nested_attribute_name" do
|
725
730
|
let(:xsd) {Schematic::Generator::Xsd.new(Object)}
|
726
731
|
it "turns 'child' into 'children-attributes'" do
|
727
|
-
xsd.nested_attribute_name('child').
|
732
|
+
expect(xsd.nested_attribute_name('child')).to eq('children-attributes')
|
728
733
|
end
|
729
734
|
|
730
735
|
it "turns 'children' into 'children-attributes'" do
|
731
|
-
xsd.nested_attribute_name('children').
|
736
|
+
expect(xsd.nested_attribute_name('children')).to eq('children-attributes')
|
732
737
|
end
|
733
738
|
|
734
739
|
it "turns 'special-children' into 'special-children-attributes'" do
|
735
|
-
xsd.nested_attribute_name(
|
740
|
+
expect(xsd.nested_attribute_name('special_children')).to eq('special-children-attributes')
|
736
741
|
end
|
737
742
|
|
738
743
|
it "properly converts symbols" do
|
739
|
-
xsd.nested_attribute_name(:very_special_children).
|
744
|
+
expect(xsd.nested_attribute_name(:very_special_children)).to eq('very-special-children-attributes')
|
740
745
|
end
|
741
746
|
end
|
742
747
|
context "when the model has a nested attribute with a different class name and foreign key than the has_many association" do
|
743
748
|
with_model :foo do
|
744
749
|
model do
|
745
|
-
has_one :bar, :class_name =>
|
746
|
-
has_many :children, :class_name =>
|
750
|
+
has_one :bar, :class_name => 'Quz', :foreign_key => 'bar_id'
|
751
|
+
has_many :children, :class_name => 'Quz', :foreign_key => 'children_id'
|
747
752
|
accepts_nested_attributes_for :children
|
748
753
|
accepts_nested_attributes_for :bar
|
749
754
|
end
|
@@ -771,11 +776,9 @@ describe Schematic::Serializers::Xsd do
|
|
771
776
|
</foos>
|
772
777
|
END
|
773
778
|
|
774
|
-
subject.
|
775
|
-
subject.
|
779
|
+
expect(subject).to include 'Quz'
|
780
|
+
expect(subject).to include 'Quzs'
|
776
781
|
validate_xml_against_xsd(test_xml, subject)
|
777
782
|
end
|
778
783
|
end
|
779
784
|
end
|
780
|
-
|
781
|
-
|
data/spec/spec_helper.rb
CHANGED
@@ -1,120 +1,15 @@
|
|
1
|
-
require "active_record"
|
2
|
-
require "with_model"
|
3
|
-
require "nokogiri"
|
4
|
-
require "schematic"
|
5
|
-
|
6
1
|
RSpec.configure do |config|
|
7
|
-
config.
|
8
|
-
|
9
|
-
|
10
|
-
ActiveRecord::Base.establish_connection(:adapter => 'sqlite3', :database => ":memory:")
|
11
|
-
|
12
|
-
def validate_xml_against_xsd(xml, xsd)
|
13
|
-
require "tempfile"
|
14
|
-
tempfile = Tempfile.new("schematic")
|
15
|
-
tempfile << xsd
|
16
|
-
tempfile.rewind
|
17
|
-
xsd = Nokogiri::XML::Schema(tempfile)
|
18
|
-
doc = Nokogiri::XML.parse(xml)
|
19
|
-
errors = []
|
20
|
-
xsd.validate(doc).each do |error|
|
21
|
-
errors << error.message
|
2
|
+
config.expect_with :rspec do |c|
|
3
|
+
c.syntax = :expect
|
22
4
|
end
|
23
|
-
errors.should == []
|
24
|
-
ensure
|
25
|
-
tempfile.close
|
26
|
-
end
|
27
|
-
|
28
|
-
def validate_xsd(xml)
|
29
|
-
xsd_schema_file = File.join(File.dirname(__FILE__), "xsd", "XMLSchema.xsd")
|
30
|
-
meta_xsd = Nokogiri::XML::Schema(File.open(xsd_schema_file))
|
31
5
|
|
32
|
-
|
33
|
-
|
34
|
-
error.message.should be_nil
|
6
|
+
config.mock_with :rspec do |c|
|
7
|
+
c.syntax = :expect
|
35
8
|
end
|
36
9
|
end
|
37
10
|
|
38
|
-
|
39
|
-
|
40
|
-
|
11
|
+
require 'support/database'
|
12
|
+
require 'support/helpers'
|
13
|
+
require 'support/with_model'
|
41
14
|
|
42
|
-
|
43
|
-
xsd_generator = model.schematic_sandbox.xsd_generator
|
44
|
-
output = <<-XML
|
45
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
46
|
-
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
|
47
|
-
<xs:complexType name="Integer">
|
48
|
-
<xs:simpleContent>
|
49
|
-
<xs:extension base="xs:integer">
|
50
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
51
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
52
|
-
</xs:extension>
|
53
|
-
</xs:simpleContent>
|
54
|
-
</xs:complexType>
|
55
|
-
<xs:complexType name="Float">
|
56
|
-
<xs:simpleContent>
|
57
|
-
<xs:extension base="xs:float">
|
58
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
59
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
60
|
-
</xs:extension>
|
61
|
-
</xs:simpleContent>
|
62
|
-
</xs:complexType>
|
63
|
-
<xs:complexType name="String">
|
64
|
-
<xs:simpleContent>
|
65
|
-
<xs:extension base="xs:string">
|
66
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
67
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
68
|
-
</xs:extension>
|
69
|
-
</xs:simpleContent>
|
70
|
-
</xs:complexType>
|
71
|
-
<xs:complexType name="Text">
|
72
|
-
<xs:simpleContent>
|
73
|
-
<xs:extension base="xs:string">
|
74
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
75
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
76
|
-
</xs:extension>
|
77
|
-
</xs:simpleContent>
|
78
|
-
</xs:complexType>
|
79
|
-
<xs:complexType name="DateTime">
|
80
|
-
<xs:simpleContent>
|
81
|
-
<xs:extension base="xs:dateTime">
|
82
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
83
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
84
|
-
</xs:extension>
|
85
|
-
</xs:simpleContent>
|
86
|
-
</xs:complexType>
|
87
|
-
<xs:complexType name="Date">
|
88
|
-
<xs:simpleContent>
|
89
|
-
<xs:extension base="xs:date">
|
90
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
91
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
92
|
-
</xs:extension>
|
93
|
-
</xs:simpleContent>
|
94
|
-
</xs:complexType>
|
95
|
-
<xs:complexType name="Boolean">
|
96
|
-
<xs:simpleContent>
|
97
|
-
<xs:extension base="xs:boolean">
|
98
|
-
<xs:attribute name="type" type="xs:string" use="optional"/>
|
99
|
-
<xs:attribute name="nil" type="xs:boolean" use="optional"/>
|
100
|
-
</xs:extension>
|
101
|
-
</xs:simpleContent>
|
102
|
-
</xs:complexType>
|
103
|
-
<xs:element name="#{xsd_generator.names.element_collection}" type="#{xsd_generator.names.collection_type}">
|
104
|
-
#{header_element}
|
105
|
-
</xs:element>
|
106
|
-
<xs:complexType name="#{xsd_generator.names.collection_type}">
|
107
|
-
<xs:sequence>
|
108
|
-
<xs:element name="#{xsd_generator.names.element}" type="#{xsd_generator.names.type}" minOccurs="0" maxOccurs="unbounded"/>
|
109
|
-
</xs:sequence>
|
110
|
-
<xs:attribute name="type" type="xs:string" fixed="array"/>
|
111
|
-
</xs:complexType>
|
112
|
-
<xs:complexType name="#{xsd_generator.names.type}">
|
113
|
-
<xs:all>
|
114
|
-
#{yield}
|
115
|
-
</xs:all>
|
116
|
-
</xs:complexType>
|
117
|
-
</xs:schema>
|
118
|
-
XML
|
119
|
-
sanitize_xml(output)
|
120
|
-
end
|
15
|
+
require 'schematic'
|