soap4r 1.5.7 → 1.5.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. data/bin/wsdl2ruby.rb +8 -2
  2. data/lib/soap/baseData.rb +93 -43
  3. data/lib/soap/element.rb +11 -8
  4. data/lib/soap/encodingstyle/handler.rb +15 -4
  5. data/lib/soap/encodingstyle/literalHandler.rb +18 -24
  6. data/lib/soap/encodingstyle/soapHandler.rb +34 -77
  7. data/lib/soap/generator.rb +74 -48
  8. data/lib/soap/header/handler.rb +1 -1
  9. data/lib/soap/header/mappinghandler.rb +47 -0
  10. data/lib/soap/mapping/encodedregistry.rb +19 -13
  11. data/lib/soap/mapping/factory.rb +19 -3
  12. data/lib/soap/mapping/literalregistry.rb +47 -35
  13. data/lib/soap/mapping/mapping.rb +92 -24
  14. data/lib/soap/mapping/registry.rb +34 -18
  15. data/lib/soap/mapping/schemadefinition.rb +8 -1
  16. data/lib/soap/mapping/typeMap.rb +18 -0
  17. data/lib/soap/mapping/wsdlencodedregistry.rb +8 -50
  18. data/lib/soap/mapping/wsdlliteralregistry.rb +45 -39
  19. data/lib/soap/nestedexception.rb +42 -0
  20. data/lib/soap/netHttpClient.rb +1 -0
  21. data/lib/soap/ns.rb +34 -0
  22. data/lib/soap/parser.rb +32 -29
  23. data/lib/soap/processor.rb +1 -1
  24. data/lib/soap/rpc/driver.rb +1 -0
  25. data/lib/soap/rpc/element.rb +18 -6
  26. data/lib/soap/rpc/httpserver.rb +38 -24
  27. data/lib/soap/rpc/proxy.rb +14 -11
  28. data/lib/soap/rpc/router.rb +4 -1
  29. data/lib/soap/soap.rb +7 -6
  30. data/lib/soap/wsdlDriver.rb +29 -8
  31. data/lib/tags +5690 -0
  32. data/lib/wsdl/definitions.rb +26 -40
  33. data/lib/wsdl/info.rb +11 -0
  34. data/lib/wsdl/parser.rb +2 -2
  35. data/lib/wsdl/soap/cgiStubCreator.rb +10 -5
  36. data/lib/wsdl/soap/classDefCreator.rb +140 -113
  37. data/lib/wsdl/soap/classDefCreatorSupport.rb +94 -12
  38. data/lib/wsdl/soap/classNameCreator.rb +54 -0
  39. data/lib/wsdl/soap/clientSkeltonCreator.rb +6 -5
  40. data/lib/wsdl/soap/complexType.rb +10 -1
  41. data/lib/wsdl/soap/definitions.rb +4 -0
  42. data/lib/wsdl/soap/driverCreator.rb +14 -6
  43. data/lib/wsdl/soap/element.rb +4 -0
  44. data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +11 -55
  45. data/lib/wsdl/soap/literalMappingRegistryCreator.rb +28 -126
  46. data/lib/wsdl/soap/mappingRegistryCreator.rb +9 -3
  47. data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +209 -94
  48. data/lib/wsdl/soap/methodDefCreator.rb +12 -16
  49. data/lib/wsdl/soap/servantSkeltonCreator.rb +3 -2
  50. data/lib/wsdl/soap/servletStubCreator.rb +107 -0
  51. data/lib/wsdl/soap/standaloneServerStubCreator.rb +10 -5
  52. data/lib/wsdl/soap/wsdl2ruby.rb +28 -13
  53. data/lib/wsdl/wsdl.rb +2 -1
  54. data/lib/wsdl/xmlSchema/anyAttribute.rb +48 -0
  55. data/lib/wsdl/xmlSchema/attributeGroup.rb +86 -0
  56. data/lib/wsdl/xmlSchema/choice.rb +4 -1
  57. data/lib/wsdl/xmlSchema/complexContent.rb +1 -1
  58. data/lib/wsdl/xmlSchema/complexExtension.rb +9 -1
  59. data/lib/wsdl/xmlSchema/complexRestriction.rb +8 -0
  60. data/lib/wsdl/xmlSchema/complexType.rb +38 -5
  61. data/lib/wsdl/xmlSchema/data.rb +30 -7
  62. data/lib/wsdl/xmlSchema/element.rb +10 -2
  63. data/lib/wsdl/xmlSchema/fractiondigits.rb +37 -0
  64. data/lib/wsdl/xmlSchema/group.rb +118 -0
  65. data/lib/wsdl/xmlSchema/import.rb +11 -23
  66. data/lib/wsdl/xmlSchema/importHandler.rb +45 -0
  67. data/lib/wsdl/xmlSchema/include.rb +11 -17
  68. data/lib/wsdl/xmlSchema/length.rb +3 -1
  69. data/lib/wsdl/xmlSchema/maxexclusive.rb +37 -0
  70. data/lib/wsdl/xmlSchema/maxinclusive.rb +37 -0
  71. data/lib/wsdl/xmlSchema/maxlength.rb +3 -1
  72. data/lib/wsdl/xmlSchema/minexclusive.rb +37 -0
  73. data/lib/wsdl/xmlSchema/mininclusive.rb +37 -0
  74. data/lib/wsdl/xmlSchema/minlength.rb +3 -1
  75. data/lib/wsdl/xmlSchema/schema.rb +34 -0
  76. data/lib/wsdl/xmlSchema/sequence.rb +4 -1
  77. data/lib/wsdl/xmlSchema/simpleExtension.rb +8 -0
  78. data/lib/wsdl/xmlSchema/simpleRestriction.rb +49 -8
  79. data/lib/wsdl/xmlSchema/totaldigits.rb +37 -0
  80. data/lib/wsdl/xmlSchema/whitespace.rb +37 -0
  81. data/lib/wsdl/xmlSchema/xsd2ruby.rb +13 -4
  82. data/lib/xsd/charset.rb +8 -6
  83. data/lib/xsd/codegen/classdef.rb +5 -0
  84. data/lib/xsd/codegen/moduledef.rb +17 -0
  85. data/lib/xsd/datatypes.rb +165 -20
  86. data/lib/xsd/mapping.rb +13 -5
  87. data/lib/xsd/namedelements.rb +8 -0
  88. data/lib/xsd/ns.rb +50 -14
  89. data/lib/xsd/qname.rb +3 -2
  90. data/lib/xsd/xmlparser.rb +4 -3
  91. data/test/soap/asp.net/test_aspdotnet.rb +1 -1
  92. data/test/soap/auth/test_basic.rb +4 -3
  93. data/test/soap/auth/test_digest.rb +4 -3
  94. data/test/soap/calc/test_calc.rb +6 -4
  95. data/test/soap/calc/test_calc2.rb +6 -4
  96. data/test/soap/calc/test_calc_cgi.rb +6 -4
  97. data/test/soap/fault/test_customfault.rb +6 -4
  98. data/test/soap/fault/test_soaparray.rb +35 -0
  99. data/test/soap/filter/test_filter.rb +2 -2
  100. data/test/soap/header/test_authheader.rb +2 -2
  101. data/test/soap/header/test_authheader_cgi.rb +3 -3
  102. data/test/soap/header/test_simplehandler.rb +2 -2
  103. data/test/soap/helloworld/test_helloworld.rb +6 -4
  104. data/test/soap/ssl/test_ssl.rb +1 -1
  105. data/test/soap/struct/test_struct.rb +2 -2
  106. data/test/soap/swa/test_file.rb +6 -4
  107. data/test/soap/test_basetype.rb +4 -4
  108. data/test/soap/test_cookie.rb +2 -2
  109. data/test/soap/test_custom_ns.rb +50 -8
  110. data/test/soap/test_custommap.rb +6 -4
  111. data/test/soap/test_empty.rb +6 -4
  112. data/test/soap/test_envelopenamespace.rb +2 -2
  113. data/test/soap/test_extraattr.rb +6 -7
  114. data/test/soap/test_generator.rb +27 -0
  115. data/test/soap/test_mapping.rb +10 -0
  116. data/test/soap/test_nestedexception.rb +56 -0
  117. data/test/soap/test_nil.rb +6 -4
  118. data/test/soap/test_no_indent.rb +6 -4
  119. data/test/soap/test_response_as_xml.rb +2 -2
  120. data/test/soap/test_streamhandler.rb +6 -3
  121. data/test/soap/test_styleuse.rb +2 -2
  122. data/test/soap/wsdlDriver/test_calc.rb +2 -2
  123. data/test/soap/wsdlDriver/test_document.rb +2 -2
  124. data/test/soap/wsdlDriver/test_simpletype.rb +2 -2
  125. data/test/wsdl/abstract/test_abstract.rb +1 -1
  126. data/test/wsdl/anonymous/expectedClassDef.rb +128 -0
  127. data/test/wsdl/anonymous/expectedDriver.rb +59 -0
  128. data/test/wsdl/anonymous/expectedMappingRegistry.rb +176 -0
  129. data/test/wsdl/anonymous/lp.wsdl +147 -0
  130. data/test/wsdl/anonymous/test_anonymous.rb +130 -0
  131. data/test/wsdl/any/expectedDriver.rb +3 -2
  132. data/test/wsdl/any/expectedEcho.rb +22 -2
  133. data/test/wsdl/any/expectedMappingRegistry.rb +63 -0
  134. data/test/wsdl/any/expectedService.rb +3 -1
  135. data/test/wsdl/any/test_any.rb +2 -7
  136. data/test/wsdl/axisArray/axisArray.wsdl +31 -4
  137. data/test/wsdl/axisArray/test_axisarray.rb +58 -3
  138. data/test/wsdl/choice/choice.wsdl +39 -0
  139. data/test/wsdl/choice/test_choice.rb +134 -7
  140. data/test/wsdl/complexcontent/test_echo.rb +1 -1
  141. data/test/wsdl/datetime/test_datetime.rb +2 -2
  142. data/test/wsdl/document/array/double.wsdl +45 -6
  143. data/test/wsdl/document/array/test_array.rb +68 -1
  144. data/test/wsdl/document/document.wsdl +2 -0
  145. data/test/wsdl/document/test_nosoapaction.rb +1 -1
  146. data/test/wsdl/document/test_number.rb +1 -1
  147. data/test/wsdl/document/test_rpc.rb +78 -9
  148. data/test/wsdl/fault/test_fault.rb +1 -1
  149. data/test/wsdl/fault/test_multifault.rb +1 -1
  150. data/test/wsdl/group/expectedClassdef.rb +58 -0
  151. data/test/wsdl/group/expectedDriver.rb +51 -0
  152. data/test/wsdl/group/expectedMappingRegistry.rb +67 -0
  153. data/test/wsdl/group/group.wsdl +88 -0
  154. data/test/wsdl/group/test_rpc.rb +145 -0
  155. data/test/wsdl/list/test_list.rb +1 -1
  156. data/test/wsdl/map/test_map.rb +2 -2
  157. data/test/wsdl/marshal/person_org.rb +5 -0
  158. data/test/wsdl/multiplefault.wsdl +11 -4
  159. data/test/wsdl/oneway/test_oneway.rb +1 -1
  160. data/test/wsdl/overload/test_overload.rb +1 -1
  161. data/test/wsdl/qualified/test_qualified.rb +1 -1
  162. data/test/wsdl/qualified/test_unqualified.rb +1 -1
  163. data/test/wsdl/raa/RAAService.rb +62 -57
  164. data/test/wsdl/raa/expectedClassDef.rb +100 -0
  165. data/test/wsdl/raa/expectedDriver.rb +96 -0
  166. data/test/wsdl/raa/expectedMappingRegistry.rb +121 -0
  167. data/test/wsdl/raa/test_raa.rb +54 -19
  168. data/test/wsdl/ref/expectedDriver.rb +1 -1
  169. data/test/wsdl/ref/expectedProduct.rb +101 -16
  170. data/test/wsdl/ref/test_ref.rb +2 -1
  171. data/test/wsdl/rpc/test_rpc.rb +1 -2
  172. data/test/wsdl/rpc/test_rpc_lit.rb +13 -13
  173. data/test/wsdl/simplecontent/test_simplecontent.rb +5 -5
  174. data/test/wsdl/simpletype/rpc/expectedDriver.rb +3 -2
  175. data/test/wsdl/simpletype/rpc/expectedEchoVersion.rb +2 -0
  176. data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +10 -17
  177. data/test/wsdl/simpletype/rpc/expectedService.rb +4 -2
  178. data/test/wsdl/simpletype/test_simpletype.rb +2 -2
  179. data/test/wsdl/soap/test_soapbodyparts.rb +2 -2
  180. data/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +2 -0
  181. data/test/wsdl/soap/wsdl2ruby/expectedDriver.rb +3 -2
  182. data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +5 -9
  183. data/test/wsdl/soap/wsdl2ruby/expectedService.cgi +4 -2
  184. data/test/wsdl/soap/wsdl2ruby/expectedService.rb +4 -2
  185. data/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +6 -0
  186. data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +1 -1
  187. data/test/wsdl/soaptype/test_soaptype.rb +1 -1
  188. data/test/wsdl/test_multiplefault.rb +3 -1
  189. data/test/xsd/codegen/test_classdef.rb +30 -0
  190. data/test/xsd/test_ns.rb +21 -0
  191. data/test/xsd/test_xsd.rb +5 -4
  192. data/test/xsd/xsd2ruby/expected_mysample.rb +13 -2
  193. data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +5 -11
  194. data/test/xsd/xsd2ruby/section.xsd +8 -0
  195. metadata +40 -8
  196. data/test/wsdl/axisArray/itemList.rb +0 -14
  197. data/test/wsdl/raa/RAA.rb +0 -120
  198. data/test/wsdl/raa/RAAServant.rb +0 -107
  199. data/test/wsdl/raa/server.rb +0 -103
@@ -0,0 +1,45 @@
1
+ # WSDL4R - XMLSchema import handler.
2
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
+
4
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
+ # redistribute it and/or modify it under the same terms of Ruby's license;
6
+ # either the dual license version in 2003, or any later version.
7
+
8
+
9
+ require 'wsdl/info'
10
+ require 'wsdl/xmlSchema/importer'
11
+
12
+
13
+ module WSDL
14
+ module XMLSchema
15
+
16
+
17
+ class ImportHandler
18
+ attr_reader :schemalocation
19
+ attr_reader :content
20
+
21
+ def initialize
22
+ @schemalocation = nil
23
+ @content = nil
24
+ end
25
+
26
+ def parse_schemalocation(location, root, parent)
27
+ @schemalocation = URI.parse(location)
28
+ if @schemalocation.relative? and !parent.location.nil? and
29
+ !parent.location.relative?
30
+ @schemalocation = parent.location + @schemalocation
31
+ end
32
+ if root.importedschema.key?(@schemalocation)
33
+ @content = root.importedschema[@schemalocation]
34
+ else
35
+ root.importedschema[@schemalocation] = nil # placeholder
36
+ @content = Importer.import(@schemalocation, root)
37
+ root.importedschema[@schemalocation] = @content
38
+ end
39
+ @schemalocation
40
+ end
41
+ end
42
+
43
+
44
+ end
45
+ end
@@ -8,6 +8,7 @@
8
8
 
9
9
  require 'wsdl/info'
10
10
  require 'wsdl/xmlSchema/importer'
11
+ require 'wsdl/xmlSchema/importHandler'
11
12
 
12
13
 
13
14
  module WSDL
@@ -15,13 +16,17 @@ module XMLSchema
15
16
 
16
17
 
17
18
  class Include < Info
18
- attr_reader :schemalocation
19
- attr_reader :content
20
-
21
19
  def initialize
22
20
  super
23
- @schemalocation = nil
24
- @content = nil
21
+ @handler = ImportHandler.new
22
+ end
23
+
24
+ def schemalocation
25
+ @handler.schemalocation
26
+ end
27
+
28
+ def content
29
+ @handler.content
25
30
  end
26
31
 
27
32
  def parse_element(element)
@@ -31,22 +36,11 @@ class Include < Info
31
36
  def parse_attr(attr, value)
32
37
  case attr
33
38
  when SchemaLocationAttrName
34
- @schemalocation = URI.parse(value.source)
35
- if @schemalocation.relative?
36
- @schemalocation = parent.location + @schemalocation
37
- end
38
- @content = import(@schemalocation)
39
- @schemalocation
39
+ @handler.parse_schemalocation(value.source, root, parent)
40
40
  else
41
41
  nil
42
42
  end
43
43
  end
44
-
45
- private
46
-
47
- def import(location)
48
- Importer.import(location)
49
- end
50
44
  end
51
45
 
52
46
 
@@ -24,8 +24,10 @@ class Length < Info
24
24
 
25
25
  def parse_attr(attr, value)
26
26
  case attr
27
+ when FixedAttrName
28
+ parent.fixed[:length] = to_boolean(value)
27
29
  when ValueAttrName
28
- parent.length = Integer(value.source)
30
+ parent.length = to_int(value)
29
31
  end
30
32
  end
31
33
  end
@@ -0,0 +1,37 @@
1
+ # WSDL4R - XMLSchema maxExclusive definition for WSDL.
2
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
+
4
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
+ # redistribute it and/or modify it under the same terms of Ruby's license;
6
+ # either the dual license version in 2003, or any later version.
7
+
8
+
9
+ require 'wsdl/info'
10
+
11
+
12
+ module WSDL
13
+ module XMLSchema
14
+
15
+
16
+ class MaxExclusive < Info
17
+ def initialize
18
+ super
19
+ end
20
+
21
+ def parse_element(element)
22
+ nil
23
+ end
24
+
25
+ def parse_attr(attr, value)
26
+ case attr
27
+ when FixedAttrName
28
+ parent.fixed[:maxexclusive] = to_boolean(value)
29
+ when ValueAttrName
30
+ parent.maxexclusive = value.source
31
+ end
32
+ end
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ # WSDL4R - XMLSchema maxInclusive definition for WSDL.
2
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
+
4
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
+ # redistribute it and/or modify it under the same terms of Ruby's license;
6
+ # either the dual license version in 2003, or any later version.
7
+
8
+
9
+ require 'wsdl/info'
10
+
11
+
12
+ module WSDL
13
+ module XMLSchema
14
+
15
+
16
+ class MaxInclusive < Info
17
+ def initialize
18
+ super
19
+ end
20
+
21
+ def parse_element(element)
22
+ nil
23
+ end
24
+
25
+ def parse_attr(attr, value)
26
+ case attr
27
+ when FixedAttrName
28
+ parent.fixed[:maxinclusive] = to_boolean(value)
29
+ when ValueAttrName
30
+ parent.maxinclusive = value.source
31
+ end
32
+ end
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -24,8 +24,10 @@ class MaxLength < Info
24
24
 
25
25
  def parse_attr(attr, value)
26
26
  case attr
27
+ when FixedAttrName
28
+ parent.fixed[:maxlength] = to_boolean(value)
27
29
  when ValueAttrName
28
- parent.maxlength = Integer(value.source)
30
+ parent.maxlength = to_int(value)
29
31
  end
30
32
  end
31
33
  end
@@ -0,0 +1,37 @@
1
+ # WSDL4R - XMLSchema minExclusive definition for WSDL.
2
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
+
4
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
+ # redistribute it and/or modify it under the same terms of Ruby's license;
6
+ # either the dual license version in 2003, or any later version.
7
+
8
+
9
+ require 'wsdl/info'
10
+
11
+
12
+ module WSDL
13
+ module XMLSchema
14
+
15
+
16
+ class MinExclusive < Info
17
+ def initialize
18
+ super
19
+ end
20
+
21
+ def parse_element(element)
22
+ nil
23
+ end
24
+
25
+ def parse_attr(attr, value)
26
+ case attr
27
+ when FixedAttrName
28
+ parent.fixed[:minexclusive] = to_boolean(value)
29
+ when ValueAttrName
30
+ parent.minexclusive = value.source
31
+ end
32
+ end
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -0,0 +1,37 @@
1
+ # WSDL4R - XMLSchema minInclusive definition for WSDL.
2
+ # Copyright (C) 2000-2007 NAKAMURA, Hiroshi <nahi@ruby-lang.org>.
3
+
4
+ # This program is copyrighted free software by NAKAMURA, Hiroshi. You can
5
+ # redistribute it and/or modify it under the same terms of Ruby's license;
6
+ # either the dual license version in 2003, or any later version.
7
+
8
+
9
+ require 'wsdl/info'
10
+
11
+
12
+ module WSDL
13
+ module XMLSchema
14
+
15
+
16
+ class MinInclusive < Info
17
+ def initialize
18
+ super
19
+ end
20
+
21
+ def parse_element(element)
22
+ nil
23
+ end
24
+
25
+ def parse_attr(attr, value)
26
+ case attr
27
+ when FixedAttrName
28
+ parent.fixed[:mininclusive] = to_boolean(value)
29
+ when ValueAttrName
30
+ parent.mininclusive = value.source
31
+ end
32
+ end
33
+ end
34
+
35
+
36
+ end
37
+ end
@@ -24,8 +24,10 @@ class MinLength < Info
24
24
 
25
25
  def parse_attr(attr, value)
26
26
  case attr
27
+ when FixedAttrName
28
+ parent.fixed[:minlength] = to_boolean(value)
27
29
  when ValueAttrName
28
- parent.minlength = Integer(value.source)
30
+ parent.minlength = to_int(value)
29
31
  end
30
32
  end
31
33
  end
@@ -20,9 +20,12 @@ class Schema < Info
20
20
  attr_reader :simpletypes
21
21
  attr_reader :elements
22
22
  attr_reader :attributes
23
+ attr_reader :modelgroups
24
+ attr_reader :attributegroups
23
25
  attr_reader :imports
24
26
  attr_accessor :attributeformdefault
25
27
  attr_accessor :elementformdefault
28
+ attr_accessor :version
26
29
 
27
30
  attr_reader :importedschema
28
31
 
@@ -33,12 +36,15 @@ class Schema < Info
33
36
  @simpletypes = XSD::NamedElements.new
34
37
  @elements = XSD::NamedElements.new
35
38
  @attributes = XSD::NamedElements.new
39
+ @modelgroups = XSD::NamedElements.new
40
+ @attributegroups = XSD::NamedElements.new
36
41
  @imports = []
37
42
  @attributeformdefault = "unqualified"
38
43
  @elementformdefault = "unqualified"
39
44
  @importedschema = {}
40
45
  @location = nil
41
46
  @root = self
47
+ @version = nil
42
48
  end
43
49
 
44
50
  def location
@@ -76,6 +82,14 @@ class Schema < Info
76
82
  o = Attribute.new
77
83
  @attributes << o
78
84
  o
85
+ when GroupName
86
+ o = Group.new
87
+ @modelgroups << o
88
+ o
89
+ when AttributeGroupName
90
+ o = AttributeGroup.new
91
+ @attributegroups << o
92
+ o
79
93
  else
80
94
  nil
81
95
  end
@@ -89,6 +103,8 @@ class Schema < Info
89
103
  @attributeformdefault = value.source
90
104
  when ElementFormDefaultAttrName
91
105
  @elementformdefault = value.source
106
+ when VersionAttrName
107
+ @version = value.source
92
108
  else
93
109
  nil
94
110
  end
@@ -103,6 +119,24 @@ class Schema < Info
103
119
  result
104
120
  end
105
121
 
122
+ def collect_modelgroups
123
+ result = XSD::NamedElements.new
124
+ result.concat(@modelgroups)
125
+ @imports.each do |import|
126
+ result.concat(import.content.collect_modelgroups) if import.content
127
+ end
128
+ result
129
+ end
130
+
131
+ def collect_attributegroups
132
+ result = XSD::NamedElements.new
133
+ result.concat(@attributegroups)
134
+ @imports.each do |import|
135
+ result.concat(import.content.collect_attributegroups) if import.content
136
+ end
137
+ result
138
+ end
139
+
106
140
  def collect_elements
107
141
  result = XSD::NamedElements.new
108
142
  result.concat(@elements)
@@ -35,8 +35,11 @@ class Sequence < Content
35
35
  o = Choice.new
36
36
  @elements << o
37
37
  o
38
+ when GroupName
39
+ o = Group.new
40
+ @elements << o
41
+ o
38
42
  when AnyName
39
- raise ElementConstraintError.new("duplicated element: any") if @any
40
43
  @any = Any.new
41
44
  @elements << @any
42
45
  @any
@@ -38,6 +38,14 @@ class SimpleExtension < Info
38
38
  o = Attribute.new
39
39
  @attributes << o
40
40
  o
41
+ when AttributeGroupName
42
+ o = AttributeGroup.new
43
+ @attributes << o
44
+ o
45
+ when AnyAttributeName
46
+ o = AnyAttribute.new
47
+ @attributes << o
48
+ o
41
49
  end
42
50
  end
43
51
 
@@ -16,11 +16,20 @@ module XMLSchema
16
16
 
17
17
  class SimpleRestriction < Info
18
18
  attr_reader :base
19
- attr_reader :enumeration
20
19
  attr_accessor :length
21
- attr_accessor :maxlength
22
20
  attr_accessor :minlength
21
+ attr_accessor :maxlength
23
22
  attr_accessor :pattern
23
+ attr_reader :enumeration
24
+ attr_accessor :whitespace
25
+ attr_accessor :maxinclusive
26
+ attr_accessor :maxexlusive
27
+ attr_accessor :minexlusive
28
+ attr_accessor :mininclusive
29
+ attr_accessor :totaldigits
30
+ attr_accessor :fractiondigits
31
+ attr_reader :fixed
32
+ attr_reader :attributes
24
33
 
25
34
  def initialize
26
35
  super
@@ -30,6 +39,8 @@ class SimpleRestriction < Info
30
39
  @maxlength = nil
31
40
  @minlength = nil
32
41
  @pattern = nil
42
+ @fixed = {}
43
+ @attributes = XSD::NamedElements.new
33
44
  end
34
45
 
35
46
  def valid?(value)
@@ -41,18 +52,48 @@ class SimpleRestriction < Info
41
52
  true
42
53
  end
43
54
 
55
+ def enumeration?
56
+ !@enumeration.empty?
57
+ end
58
+
44
59
  def parse_element(element)
45
60
  case element
46
- when EnumerationName
47
- Enumeration.new
48
61
  when LengthName
49
62
  Length.new
50
- when PatternName
51
- Pattern.new
52
- when MaxLengthName
53
- MaxLength.new
54
63
  when MinLengthName
55
64
  MinLength.new
65
+ when MaxLengthName
66
+ MaxLength.new
67
+ when PatternName
68
+ Pattern.new
69
+ when EnumerationName
70
+ Enumeration.new
71
+ when WhiteSpaceName
72
+ WhiteSpace.new
73
+ when MaxInclusiveName
74
+ MaxInclusive.new
75
+ when MaxExclusiveName
76
+ MaxExlusive.new
77
+ when MinExclusiveName
78
+ MinExlusive.new
79
+ when MinInclusiveName
80
+ MinInclusive.new
81
+ when TotalDigitsName
82
+ TotalDigits.new
83
+ when FractionDigitsName
84
+ FractionDigits.new
85
+ when AttributeName
86
+ o = Attribute.new
87
+ @attributes << o
88
+ o
89
+ when AttributeGroupName
90
+ o = AttributeGroup.new
91
+ @attributes << o
92
+ o
93
+ when AnyAttributeName
94
+ o = AnyAttribute.new
95
+ @attributes << o
96
+ o
56
97
  end
57
98
  end
58
99