soap4r 1.5.7 → 1.5.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/wsdl2ruby.rb +8 -2
- data/lib/soap/baseData.rb +93 -43
- data/lib/soap/element.rb +11 -8
- data/lib/soap/encodingstyle/handler.rb +15 -4
- data/lib/soap/encodingstyle/literalHandler.rb +18 -24
- data/lib/soap/encodingstyle/soapHandler.rb +34 -77
- data/lib/soap/generator.rb +74 -48
- data/lib/soap/header/handler.rb +1 -1
- data/lib/soap/header/mappinghandler.rb +47 -0
- data/lib/soap/mapping/encodedregistry.rb +19 -13
- data/lib/soap/mapping/factory.rb +19 -3
- data/lib/soap/mapping/literalregistry.rb +47 -35
- data/lib/soap/mapping/mapping.rb +92 -24
- data/lib/soap/mapping/registry.rb +34 -18
- data/lib/soap/mapping/schemadefinition.rb +8 -1
- data/lib/soap/mapping/typeMap.rb +18 -0
- data/lib/soap/mapping/wsdlencodedregistry.rb +8 -50
- data/lib/soap/mapping/wsdlliteralregistry.rb +45 -39
- data/lib/soap/nestedexception.rb +42 -0
- data/lib/soap/netHttpClient.rb +1 -0
- data/lib/soap/ns.rb +34 -0
- data/lib/soap/parser.rb +32 -29
- data/lib/soap/processor.rb +1 -1
- data/lib/soap/rpc/driver.rb +1 -0
- data/lib/soap/rpc/element.rb +18 -6
- data/lib/soap/rpc/httpserver.rb +38 -24
- data/lib/soap/rpc/proxy.rb +14 -11
- data/lib/soap/rpc/router.rb +4 -1
- data/lib/soap/soap.rb +7 -6
- data/lib/soap/wsdlDriver.rb +29 -8
- data/lib/tags +5690 -0
- data/lib/wsdl/definitions.rb +26 -40
- data/lib/wsdl/info.rb +11 -0
- data/lib/wsdl/parser.rb +2 -2
- data/lib/wsdl/soap/cgiStubCreator.rb +10 -5
- data/lib/wsdl/soap/classDefCreator.rb +140 -113
- data/lib/wsdl/soap/classDefCreatorSupport.rb +94 -12
- data/lib/wsdl/soap/classNameCreator.rb +54 -0
- data/lib/wsdl/soap/clientSkeltonCreator.rb +6 -5
- data/lib/wsdl/soap/complexType.rb +10 -1
- data/lib/wsdl/soap/definitions.rb +4 -0
- data/lib/wsdl/soap/driverCreator.rb +14 -6
- data/lib/wsdl/soap/element.rb +4 -0
- data/lib/wsdl/soap/encodedMappingRegistryCreator.rb +11 -55
- data/lib/wsdl/soap/literalMappingRegistryCreator.rb +28 -126
- data/lib/wsdl/soap/mappingRegistryCreator.rb +9 -3
- data/lib/wsdl/soap/mappingRegistryCreatorSupport.rb +209 -94
- data/lib/wsdl/soap/methodDefCreator.rb +12 -16
- data/lib/wsdl/soap/servantSkeltonCreator.rb +3 -2
- data/lib/wsdl/soap/servletStubCreator.rb +107 -0
- data/lib/wsdl/soap/standaloneServerStubCreator.rb +10 -5
- data/lib/wsdl/soap/wsdl2ruby.rb +28 -13
- data/lib/wsdl/wsdl.rb +2 -1
- data/lib/wsdl/xmlSchema/anyAttribute.rb +48 -0
- data/lib/wsdl/xmlSchema/attributeGroup.rb +86 -0
- data/lib/wsdl/xmlSchema/choice.rb +4 -1
- data/lib/wsdl/xmlSchema/complexContent.rb +1 -1
- data/lib/wsdl/xmlSchema/complexExtension.rb +9 -1
- data/lib/wsdl/xmlSchema/complexRestriction.rb +8 -0
- data/lib/wsdl/xmlSchema/complexType.rb +38 -5
- data/lib/wsdl/xmlSchema/data.rb +30 -7
- data/lib/wsdl/xmlSchema/element.rb +10 -2
- data/lib/wsdl/xmlSchema/fractiondigits.rb +37 -0
- data/lib/wsdl/xmlSchema/group.rb +118 -0
- data/lib/wsdl/xmlSchema/import.rb +11 -23
- data/lib/wsdl/xmlSchema/importHandler.rb +45 -0
- data/lib/wsdl/xmlSchema/include.rb +11 -17
- data/lib/wsdl/xmlSchema/length.rb +3 -1
- data/lib/wsdl/xmlSchema/maxexclusive.rb +37 -0
- data/lib/wsdl/xmlSchema/maxinclusive.rb +37 -0
- data/lib/wsdl/xmlSchema/maxlength.rb +3 -1
- data/lib/wsdl/xmlSchema/minexclusive.rb +37 -0
- data/lib/wsdl/xmlSchema/mininclusive.rb +37 -0
- data/lib/wsdl/xmlSchema/minlength.rb +3 -1
- data/lib/wsdl/xmlSchema/schema.rb +34 -0
- data/lib/wsdl/xmlSchema/sequence.rb +4 -1
- data/lib/wsdl/xmlSchema/simpleExtension.rb +8 -0
- data/lib/wsdl/xmlSchema/simpleRestriction.rb +49 -8
- data/lib/wsdl/xmlSchema/totaldigits.rb +37 -0
- data/lib/wsdl/xmlSchema/whitespace.rb +37 -0
- data/lib/wsdl/xmlSchema/xsd2ruby.rb +13 -4
- data/lib/xsd/charset.rb +8 -6
- data/lib/xsd/codegen/classdef.rb +5 -0
- data/lib/xsd/codegen/moduledef.rb +17 -0
- data/lib/xsd/datatypes.rb +165 -20
- data/lib/xsd/mapping.rb +13 -5
- data/lib/xsd/namedelements.rb +8 -0
- data/lib/xsd/ns.rb +50 -14
- data/lib/xsd/qname.rb +3 -2
- data/lib/xsd/xmlparser.rb +4 -3
- data/test/soap/asp.net/test_aspdotnet.rb +1 -1
- data/test/soap/auth/test_basic.rb +4 -3
- data/test/soap/auth/test_digest.rb +4 -3
- data/test/soap/calc/test_calc.rb +6 -4
- data/test/soap/calc/test_calc2.rb +6 -4
- data/test/soap/calc/test_calc_cgi.rb +6 -4
- data/test/soap/fault/test_customfault.rb +6 -4
- data/test/soap/fault/test_soaparray.rb +35 -0
- data/test/soap/filter/test_filter.rb +2 -2
- data/test/soap/header/test_authheader.rb +2 -2
- data/test/soap/header/test_authheader_cgi.rb +3 -3
- data/test/soap/header/test_simplehandler.rb +2 -2
- data/test/soap/helloworld/test_helloworld.rb +6 -4
- data/test/soap/ssl/test_ssl.rb +1 -1
- data/test/soap/struct/test_struct.rb +2 -2
- data/test/soap/swa/test_file.rb +6 -4
- data/test/soap/test_basetype.rb +4 -4
- data/test/soap/test_cookie.rb +2 -2
- data/test/soap/test_custom_ns.rb +50 -8
- data/test/soap/test_custommap.rb +6 -4
- data/test/soap/test_empty.rb +6 -4
- data/test/soap/test_envelopenamespace.rb +2 -2
- data/test/soap/test_extraattr.rb +6 -7
- data/test/soap/test_generator.rb +27 -0
- data/test/soap/test_mapping.rb +10 -0
- data/test/soap/test_nestedexception.rb +56 -0
- data/test/soap/test_nil.rb +6 -4
- data/test/soap/test_no_indent.rb +6 -4
- data/test/soap/test_response_as_xml.rb +2 -2
- data/test/soap/test_streamhandler.rb +6 -3
- data/test/soap/test_styleuse.rb +2 -2
- data/test/soap/wsdlDriver/test_calc.rb +2 -2
- data/test/soap/wsdlDriver/test_document.rb +2 -2
- data/test/soap/wsdlDriver/test_simpletype.rb +2 -2
- data/test/wsdl/abstract/test_abstract.rb +1 -1
- data/test/wsdl/anonymous/expectedClassDef.rb +128 -0
- data/test/wsdl/anonymous/expectedDriver.rb +59 -0
- data/test/wsdl/anonymous/expectedMappingRegistry.rb +176 -0
- data/test/wsdl/anonymous/lp.wsdl +147 -0
- data/test/wsdl/anonymous/test_anonymous.rb +130 -0
- data/test/wsdl/any/expectedDriver.rb +3 -2
- data/test/wsdl/any/expectedEcho.rb +22 -2
- data/test/wsdl/any/expectedMappingRegistry.rb +63 -0
- data/test/wsdl/any/expectedService.rb +3 -1
- data/test/wsdl/any/test_any.rb +2 -7
- data/test/wsdl/axisArray/axisArray.wsdl +31 -4
- data/test/wsdl/axisArray/test_axisarray.rb +58 -3
- data/test/wsdl/choice/choice.wsdl +39 -0
- data/test/wsdl/choice/test_choice.rb +134 -7
- data/test/wsdl/complexcontent/test_echo.rb +1 -1
- data/test/wsdl/datetime/test_datetime.rb +2 -2
- data/test/wsdl/document/array/double.wsdl +45 -6
- data/test/wsdl/document/array/test_array.rb +68 -1
- data/test/wsdl/document/document.wsdl +2 -0
- data/test/wsdl/document/test_nosoapaction.rb +1 -1
- data/test/wsdl/document/test_number.rb +1 -1
- data/test/wsdl/document/test_rpc.rb +78 -9
- data/test/wsdl/fault/test_fault.rb +1 -1
- data/test/wsdl/fault/test_multifault.rb +1 -1
- data/test/wsdl/group/expectedClassdef.rb +58 -0
- data/test/wsdl/group/expectedDriver.rb +51 -0
- data/test/wsdl/group/expectedMappingRegistry.rb +67 -0
- data/test/wsdl/group/group.wsdl +88 -0
- data/test/wsdl/group/test_rpc.rb +145 -0
- data/test/wsdl/list/test_list.rb +1 -1
- data/test/wsdl/map/test_map.rb +2 -2
- data/test/wsdl/marshal/person_org.rb +5 -0
- data/test/wsdl/multiplefault.wsdl +11 -4
- data/test/wsdl/oneway/test_oneway.rb +1 -1
- data/test/wsdl/overload/test_overload.rb +1 -1
- data/test/wsdl/qualified/test_qualified.rb +1 -1
- data/test/wsdl/qualified/test_unqualified.rb +1 -1
- data/test/wsdl/raa/RAAService.rb +62 -57
- data/test/wsdl/raa/expectedClassDef.rb +100 -0
- data/test/wsdl/raa/expectedDriver.rb +96 -0
- data/test/wsdl/raa/expectedMappingRegistry.rb +121 -0
- data/test/wsdl/raa/test_raa.rb +54 -19
- data/test/wsdl/ref/expectedDriver.rb +1 -1
- data/test/wsdl/ref/expectedProduct.rb +101 -16
- data/test/wsdl/ref/test_ref.rb +2 -1
- data/test/wsdl/rpc/test_rpc.rb +1 -2
- data/test/wsdl/rpc/test_rpc_lit.rb +13 -13
- data/test/wsdl/simplecontent/test_simplecontent.rb +5 -5
- data/test/wsdl/simpletype/rpc/expectedDriver.rb +3 -2
- data/test/wsdl/simpletype/rpc/expectedEchoVersion.rb +2 -0
- data/test/wsdl/simpletype/rpc/expectedMappingRegistry.rb +10 -17
- data/test/wsdl/simpletype/rpc/expectedService.rb +4 -2
- data/test/wsdl/simpletype/test_simpletype.rb +2 -2
- data/test/wsdl/soap/test_soapbodyparts.rb +2 -2
- data/test/wsdl/soap/wsdl2ruby/expectedClassdef.rb +2 -0
- data/test/wsdl/soap/wsdl2ruby/expectedDriver.rb +3 -2
- data/test/wsdl/soap/wsdl2ruby/expectedMappingRegistry.rb +5 -9
- data/test/wsdl/soap/wsdl2ruby/expectedService.cgi +4 -2
- data/test/wsdl/soap/wsdl2ruby/expectedService.rb +4 -2
- data/test/wsdl/soap/wsdl2ruby/section/expectedClassdef.rb +6 -0
- data/test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb +1 -1
- data/test/wsdl/soaptype/test_soaptype.rb +1 -1
- data/test/wsdl/test_multiplefault.rb +3 -1
- data/test/xsd/codegen/test_classdef.rb +30 -0
- data/test/xsd/test_ns.rb +21 -0
- data/test/xsd/test_xsd.rb +5 -4
- data/test/xsd/xsd2ruby/expected_mysample.rb +13 -2
- data/test/xsd/xsd2ruby/expected_mysample_mapping_registry.rb +5 -11
- data/test/xsd/xsd2ruby/section.xsd +8 -0
- metadata +40 -8
- data/test/wsdl/axisArray/itemList.rb +0 -14
- data/test/wsdl/raa/RAA.rb +0 -120
- data/test/wsdl/raa/RAAServant.rb +0 -107
- 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
|
-
@
|
24
|
-
|
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
|
-
@
|
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
|
|
@@ -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 =
|
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 =
|
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
|
@@ -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
|
|