xsd 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +9 -0
- data/README.md +3 -2
- data/lib/xsd/base_object.rb +35 -35
- data/lib/xsd/generator.rb +7 -7
- data/lib/xsd/objects/all.rb +2 -2
- data/lib/xsd/objects/annotation.rb +2 -2
- data/lib/xsd/objects/any.rb +2 -2
- data/lib/xsd/objects/any_attribute.rb +2 -2
- data/lib/xsd/objects/appinfo.rb +1 -1
- data/lib/xsd/objects/attribute.rb +9 -9
- data/lib/xsd/objects/attribute_group.rb +1 -1
- data/lib/xsd/objects/choice.rb +4 -4
- data/lib/xsd/objects/complex_content.rb +3 -3
- data/lib/xsd/objects/complex_type.rb +12 -12
- data/lib/xsd/objects/documentation.rb +2 -2
- data/lib/xsd/objects/element.rb +19 -19
- data/lib/xsd/objects/facet.rb +1 -1
- data/lib/xsd/objects/field.rb +1 -1
- data/lib/xsd/objects/group.rb +4 -4
- data/lib/xsd/objects/import.rb +15 -44
- data/lib/xsd/objects/key.rb +3 -3
- data/lib/xsd/objects/keyref.rb +4 -4
- data/lib/xsd/objects/list.rb +1 -1
- data/lib/xsd/objects/restriction.rb +3 -3
- data/lib/xsd/objects/schema.rb +31 -31
- data/lib/xsd/objects/selector.rb +1 -1
- data/lib/xsd/objects/sequence.rb +4 -4
- data/lib/xsd/objects/simple_content.rb +2 -2
- data/lib/xsd/objects/simple_type.rb +5 -5
- data/lib/xsd/objects/union.rb +2 -2
- data/lib/xsd/objects/unique.rb +2 -2
- data/lib/xsd/shared/attribute_container.rb +2 -2
- data/lib/xsd/shared/based.rb +9 -9
- data/lib/xsd/shared/complex_typed.rb +7 -7
- data/lib/xsd/shared/element_container.rb +1 -1
- data/lib/xsd/shared/min_max_occurs.rb +4 -4
- data/lib/xsd/shared/referenced.rb +3 -3
- data/lib/xsd/shared/simple_typed.rb +1 -1
- data/lib/xsd/validator.rb +1 -1
- data/lib/xsd/version.rb +1 -1
- data/lib/xsd/xml.rb +102 -31
- data/xsd.gemspec +0 -8
- metadata +2 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ee4b9e2059eeb7c7109e687ca866c3617514e167f2d93de816d452fdf01be85b
|
4
|
+
data.tar.gz: ee5451af6e745dbdfffc55fa26329fd2c68b3257699a6e65fd923da3278769ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c937c9501cac27b7d1a003d34feec5fc927663656793c0e2a4abb62112f7b36ee7001532eccc1f1557913c23355feddab616a9df493fe2c7556fb3eaa74d50ce
|
7
|
+
data.tar.gz: 588d4649a016ed883a401447435a3a01512a610d1bc5b46b8abae0d6b0367ffe2369073f4f0f8bdb834643321f2a22eda196d89315d6e84f3b0222f4eee0c622
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [2.0.0] - 2023-07-07
|
4
|
+
|
5
|
+
- Change XSD::XML.new(file, **options) -> XSD::XML.open(file, **options)
|
6
|
+
- Add ability to construct empty reader (reader = XSD::XML.new(**options)) and manually add schemas to it (reader.add_schema_xml(xml))
|
7
|
+
- Add ability to configure import resources resolver via options
|
8
|
+
|
3
9
|
## [1.0.0] - 2023-04-25
|
4
10
|
|
5
11
|
- Initial release
|
data/Gemfile
CHANGED
@@ -4,3 +4,12 @@ source 'https://rubygems.org'
|
|
4
4
|
|
5
5
|
# Specify your gem's dependencies in xsd_to_json.gemspec
|
6
6
|
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem 'logger', '~> 1.5'
|
10
|
+
gem 'rspec', '~> 3.12'
|
11
|
+
gem 'rubocop', '~> 1.50'
|
12
|
+
gem 'rubocop-performance', '~> 1.17'
|
13
|
+
gem 'rubocop-rake', '~> 0.6'
|
14
|
+
gem 'rubocop-rspec', '~> 2.10'
|
15
|
+
end
|
data/README.md
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
# XSD
|
2
|
-
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/xsd.svg)][gem]
|
3
3
|
[![Ruby](https://github.com/ekzo-dev/ruby-xsd/actions/workflows/main.yml/badge.svg)][githubactions]
|
4
4
|
|
5
|
+
[gem]: https://badge.fury.io/rb/xsd
|
5
6
|
[githubactions]: https://github.com/omniauth/omniauth/actions/workflows/main.yml
|
6
7
|
|
7
8
|
The Ruby XSD library is an [XML Schema](https://www.w3.org/2001/XMLSchema) implementation for Ruby. Provides easy and
|
@@ -25,7 +26,7 @@ gem 'xsd'
|
|
25
26
|
require 'xsd'
|
26
27
|
|
27
28
|
# Load ruby-xsd
|
28
|
-
reader = XSD::XML.
|
29
|
+
reader = XSD::XML.open('some.xsd')
|
29
30
|
|
30
31
|
# Get attributes
|
31
32
|
attribute = reader['NewReleaseMessage']['@MessageSchemaVersionId']
|
data/lib/xsd/base_object.rb
CHANGED
@@ -34,7 +34,7 @@ module XSD
|
|
34
34
|
|
35
35
|
# Optional. Specifies a unique ID for the element
|
36
36
|
# @!attribute id
|
37
|
-
# @return
|
37
|
+
# @return String
|
38
38
|
# property :id, :string
|
39
39
|
def id
|
40
40
|
node['id']
|
@@ -48,39 +48,39 @@ module XSD
|
|
48
48
|
end
|
49
49
|
|
50
50
|
# Get current XML node
|
51
|
-
# @return
|
51
|
+
# @return Nokogiri::XML::Node
|
52
52
|
def node
|
53
53
|
options[:node]
|
54
54
|
end
|
55
55
|
|
56
56
|
# Get current namespaces
|
57
|
-
# @return
|
57
|
+
# @return Hash
|
58
58
|
def namespaces
|
59
59
|
node.namespaces || {}
|
60
60
|
end
|
61
61
|
|
62
62
|
# Get child nodes
|
63
63
|
# @param [Symbol] name
|
64
|
-
# @return
|
64
|
+
# @return Nokogiri::XML::NodeSet
|
65
65
|
def nodes(name = :*)
|
66
66
|
node.xpath("./xs:#{name}", { 'xs' => XML_SCHEMA })
|
67
67
|
end
|
68
68
|
|
69
|
-
# Get schema
|
70
|
-
# @param [String]
|
71
|
-
# @return
|
72
|
-
def schema_for_namespace(
|
73
|
-
if schema.targets_namespace?(
|
69
|
+
# Get schema by namespace or namespace prefix
|
70
|
+
# @param [String] namespace
|
71
|
+
# @return Schema
|
72
|
+
def schema_for_namespace(namespace)
|
73
|
+
if schema.targets_namespace?(namespace)
|
74
74
|
schema
|
75
|
-
elsif (import = schema.import_by_namespace(
|
76
|
-
import.
|
75
|
+
elsif (import = schema.import_by_namespace(namespace))
|
76
|
+
import.imported_schema
|
77
77
|
else
|
78
|
-
raise Error, "Schema not found for namespace '#{
|
78
|
+
raise Error, "Schema not found for namespace '#{namespace}' in '#{schema.id || schema.target_namespace}'"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
# Get element or attribute by path
|
83
|
-
# @return
|
83
|
+
# @return Element, Attribute, nil
|
84
84
|
def [](*args)
|
85
85
|
result = self
|
86
86
|
|
@@ -90,9 +90,9 @@ module XSD
|
|
90
90
|
curname = curname.to_s
|
91
91
|
|
92
92
|
if curname[0] == '@'
|
93
|
-
result = result.
|
93
|
+
result = result.collect_attributes.find { |attr| attr.name == curname[1..-1] }
|
94
94
|
else
|
95
|
-
result = result.
|
95
|
+
result = result.collect_elements.find { |elem| elem.name == curname }
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
@@ -102,7 +102,7 @@ module XSD
|
|
102
102
|
# Search node by name in all available schemas and return its object
|
103
103
|
# @param [Symbol] node_name
|
104
104
|
# @param [String] name
|
105
|
-
# @return
|
105
|
+
# @return BaseObject, nil
|
106
106
|
def object_by_name(node_name, name)
|
107
107
|
# get prefix and local name
|
108
108
|
name_prefix = get_prefix(name)
|
@@ -122,7 +122,7 @@ module XSD
|
|
122
122
|
|
123
123
|
# Get reader object for node
|
124
124
|
# @param [Nokogiri::XML::Node]
|
125
|
-
# @return
|
125
|
+
# @return BaseObject
|
126
126
|
def node_to_object(node)
|
127
127
|
# check object in cache first
|
128
128
|
# TODO: проверить работу!
|
@@ -135,66 +135,66 @@ module XSD
|
|
135
135
|
end
|
136
136
|
|
137
137
|
# Get xml parent object
|
138
|
-
# @return
|
138
|
+
# @return BaseObject, nil
|
139
139
|
def parent
|
140
140
|
node.respond_to?(:parent) && node.parent ? node_to_object(node.parent) : nil
|
141
141
|
end
|
142
142
|
|
143
143
|
# Get current schema object
|
144
|
-
# @return
|
144
|
+
# @return Schema
|
145
145
|
def schema
|
146
146
|
options[:schema]
|
147
147
|
end
|
148
148
|
|
149
149
|
# Get child objects
|
150
150
|
# @param [Symbol] name
|
151
|
-
# @return
|
151
|
+
# @return Array<BaseObject>
|
152
152
|
def map_children(name)
|
153
153
|
nodes(name).map { |node| node_to_object(node) }
|
154
154
|
end
|
155
155
|
|
156
156
|
# Get child object
|
157
157
|
# @param [Symbol] name
|
158
|
-
# @return
|
158
|
+
# @return BaseObject, nil
|
159
159
|
def map_child(name)
|
160
160
|
map_children(name).first
|
161
161
|
end
|
162
162
|
|
163
163
|
# Strip namespace prefix from node name
|
164
164
|
# @param [String, nil] name Name to strip from
|
165
|
-
# @return
|
165
|
+
# @return String, nil
|
166
166
|
def strip_prefix(name)
|
167
167
|
name&.include?(':') ? name.split(':').last : name
|
168
168
|
end
|
169
169
|
|
170
170
|
# Get namespace prefix from node name
|
171
171
|
# @param [String, nil] name Name to strip from
|
172
|
-
# @return
|
172
|
+
# @return String
|
173
173
|
def get_prefix(name)
|
174
174
|
name&.include?(':') ? name.split(':').first : ''
|
175
175
|
end
|
176
176
|
|
177
177
|
# Return element documentation
|
178
|
-
# @return
|
178
|
+
# @return Array<String>
|
179
179
|
def documentation
|
180
180
|
documentation_for(node)
|
181
181
|
end
|
182
182
|
|
183
183
|
# Return documentation for specified node
|
184
184
|
# @param [Nokogiri::XML::Node] node
|
185
|
-
# @return
|
185
|
+
# @return Array<String>
|
186
186
|
def documentation_for(node)
|
187
187
|
node.xpath('./xs:annotation/xs:documentation/text()', { 'xs' => XML_SCHEMA }).map(&:to_s).map(&:strip)
|
188
188
|
end
|
189
189
|
|
190
190
|
# Get all available elements on the current stack level
|
191
|
-
# @return
|
192
|
-
def
|
191
|
+
# @return Array<Element>
|
192
|
+
def collect_elements(*)
|
193
193
|
# exclude element that can not have elements
|
194
194
|
return [] if NO_ELEMENTS_CONTAINER.include?(self.class.mapped_name)
|
195
195
|
|
196
196
|
if is_a?(Referenced) && ref
|
197
|
-
reference.
|
197
|
+
reference.collect_elements
|
198
198
|
else
|
199
199
|
# map children recursive
|
200
200
|
map_children(:*).map do |obj|
|
@@ -202,20 +202,20 @@ module XSD
|
|
202
202
|
obj
|
203
203
|
else
|
204
204
|
# get elements considering references
|
205
|
-
(obj.is_a?(Referenced) && obj.ref ? obj.reference : obj).
|
205
|
+
(obj.is_a?(Referenced) && obj.ref ? obj.reference : obj).collect_elements
|
206
206
|
end
|
207
207
|
end.flatten
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
211
|
# Get all available attributes on the current stack level
|
212
|
-
# @return
|
213
|
-
def
|
212
|
+
# @return Array<Attribute>
|
213
|
+
def collect_attributes(*)
|
214
214
|
# exclude element that can not have elements
|
215
215
|
return [] if NO_ATTRIBUTES_CONTAINER.include?(self.class.mapped_name)
|
216
216
|
|
217
217
|
if is_a?(Referenced) && ref
|
218
|
-
reference.
|
218
|
+
reference.collect_attributes
|
219
219
|
else
|
220
220
|
# map children recursive
|
221
221
|
map_children(:*).map do |obj|
|
@@ -223,14 +223,14 @@ module XSD
|
|
223
223
|
obj
|
224
224
|
else
|
225
225
|
# get attributes considering references
|
226
|
-
(obj.is_a?(Referenced) && obj.ref ? obj.reference : obj).
|
226
|
+
(obj.is_a?(Referenced) && obj.ref ? obj.reference : obj).collect_attributes
|
227
227
|
end
|
228
228
|
end.flatten
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|
232
232
|
# Get reader instance
|
233
|
-
# @return
|
233
|
+
# @return XML
|
234
234
|
def reader
|
235
235
|
options[:reader]
|
236
236
|
end
|
@@ -334,7 +334,7 @@ module XSD
|
|
334
334
|
end
|
335
335
|
|
336
336
|
# Get mapped element name
|
337
|
-
# @return
|
337
|
+
# @return Symbol
|
338
338
|
def self.mapped_name
|
339
339
|
# @mapped_name ||= XML::CLASS_MAP.each { |k, v| return k.to_sym if v == self }
|
340
340
|
@mapped_name ||= begin
|
data/lib/xsd/generator.rb
CHANGED
@@ -8,7 +8,7 @@ module XSD
|
|
8
8
|
# @param [Hash] data
|
9
9
|
# @param [String, Array<String>] element
|
10
10
|
# @param [Builder::XmlMarkup] builder
|
11
|
-
# @return
|
11
|
+
# @return Builder::XmlMarkup
|
12
12
|
def generate(data, element = nil, builder = nil)
|
13
13
|
# find root element
|
14
14
|
root = find_root_element(element)
|
@@ -59,13 +59,13 @@ module XSD
|
|
59
59
|
# configure namespaces
|
60
60
|
# TODO: попытаться использовать collect_namespaces?
|
61
61
|
attributes = {}
|
62
|
-
|
62
|
+
collect_attributes = element.collect_attributes
|
63
63
|
if element.complex?
|
64
|
-
|
64
|
+
collect_elements = element.collect_elements
|
65
65
|
|
66
66
|
# get namespaces for current element and it's children
|
67
67
|
prefix = nil
|
68
|
-
[*
|
68
|
+
[*collect_elements, element].each do |elem|
|
69
69
|
prefix = get_namespace_prefix(elem, attributes, namespaces)
|
70
70
|
end
|
71
71
|
else
|
@@ -75,7 +75,7 @@ module XSD
|
|
75
75
|
# iterate through each item
|
76
76
|
data.each do |item|
|
77
77
|
# prepare attributes
|
78
|
-
|
78
|
+
collect_attributes.each do |attribute|
|
79
79
|
value = item["@#{attribute.name}"]
|
80
80
|
if value
|
81
81
|
attributes[attribute.name] = value
|
@@ -88,7 +88,7 @@ module XSD
|
|
88
88
|
if element.complex?
|
89
89
|
# generate tag recursively
|
90
90
|
xml.tag!("#{prefix}:#{element.name}", attributes) do
|
91
|
-
|
91
|
+
collect_elements.each do |elem|
|
92
92
|
build_element(xml, elem, item, namespaces.dup)
|
93
93
|
end
|
94
94
|
end
|
@@ -103,7 +103,7 @@ module XSD
|
|
103
103
|
# @param [Element] element
|
104
104
|
# @param [Hash] attributes
|
105
105
|
# @param [Hash] namespaces
|
106
|
-
# @return
|
106
|
+
# @return String
|
107
107
|
def get_namespace_prefix(element, attributes, namespaces)
|
108
108
|
namespace = (element.referenced? ? element.reference : element).target_namespace
|
109
109
|
prefix = namespaces.key(namespace)
|
data/lib/xsd/objects/all.rb
CHANGED
@@ -11,12 +11,12 @@ module XSD
|
|
11
11
|
|
12
12
|
# Optional. Specifies the minimum number of times the element can occur. The value can be 0 or 1. Default value is 1
|
13
13
|
# @!attribute min_occurs
|
14
|
-
# @return
|
14
|
+
# @return Integer
|
15
15
|
property :minOccurs, :integer, default: 1
|
16
16
|
|
17
17
|
# Optional. Specifies the maximum number of times the element can occur. The value must be 1.
|
18
18
|
# @!attribute max_occurs
|
19
|
-
# @return
|
19
|
+
# @return Integer
|
20
20
|
property :maxOccurs, :integer, default: 1
|
21
21
|
end
|
22
22
|
end
|
@@ -8,12 +8,12 @@ module XSD
|
|
8
8
|
class Annotation < BaseObject
|
9
9
|
# Nested appinfos
|
10
10
|
# @!attribute appinfos
|
11
|
-
# @return
|
11
|
+
# @return Array<Appinfo>
|
12
12
|
child :appinfos, [:appinfo]
|
13
13
|
|
14
14
|
# Nested documentations
|
15
15
|
# @!attribute documentations
|
16
|
-
# @return
|
16
|
+
# @return Array<Documentation>
|
17
17
|
child :documentations, [:documentation]
|
18
18
|
end
|
19
19
|
end
|
data/lib/xsd/objects/any.rb
CHANGED
@@ -15,7 +15,7 @@ module XSD
|
|
15
15
|
# List of {URI references of namespaces, ##targetNamespace, ##local} - elements from a space-delimited list of
|
16
16
|
# the namespaces can be present
|
17
17
|
# @!attribute namespace
|
18
|
-
# @return
|
18
|
+
# @return String
|
19
19
|
property :namespace, :string, default: '##any'
|
20
20
|
|
21
21
|
# Optional. Specifies how the XML processor should handle validation against the elements specified by this any
|
@@ -25,7 +25,7 @@ module XSD
|
|
25
25
|
# lax - same as strict but; if the schema cannot be obtained, no errors will occur
|
26
26
|
# skip - The XML processor does not attempt to validate any elements from the specified namespaces
|
27
27
|
# @!attribute process_contents
|
28
|
-
# @return
|
28
|
+
# @return String, nil
|
29
29
|
property :processContents, :string, default: 'strict'
|
30
30
|
end
|
31
31
|
end
|
@@ -14,7 +14,7 @@ module XSD
|
|
14
14
|
# List of {URI references of namespaces, ##targetNamespace, ##local} - attributes from a space-delimited list
|
15
15
|
# of the namespaces can be present
|
16
16
|
# @!attribute namespace
|
17
|
-
# @return
|
17
|
+
# @return String
|
18
18
|
property :namespace, :string, default: '##any'
|
19
19
|
|
20
20
|
# Optional. Specifies how the XML processor should handle validation against the elements specified by this any
|
@@ -24,7 +24,7 @@ module XSD
|
|
24
24
|
# lax - same as strict but; if the schema cannot be obtained, no errors will occur
|
25
25
|
# skip - The XML processor does not attempt to validate any elements from the specified namespaces
|
26
26
|
# @!attribute process_contents
|
27
|
-
# @return
|
27
|
+
# @return String, nil
|
28
28
|
property :processContents, :string, default: 'strict'
|
29
29
|
end
|
30
30
|
end
|
data/lib/xsd/objects/appinfo.rb
CHANGED
@@ -13,17 +13,17 @@ module XSD
|
|
13
13
|
|
14
14
|
# Optional. Specifies the name of the attribute. Name and ref attributes cannot both be present
|
15
15
|
# @!attribute name
|
16
|
-
# @return
|
16
|
+
# @return String
|
17
17
|
property :name, :string
|
18
18
|
|
19
19
|
# Optional. Specifies a default value for the attribute. Default and fixed attributes cannot both be present
|
20
20
|
# @!attribute default
|
21
|
-
# @return
|
21
|
+
# @return String, nil
|
22
22
|
property :default, :string
|
23
23
|
|
24
24
|
# Optional. Specifies a fixed value for the attribute. Default and fixed attributes cannot both be present
|
25
25
|
# @!attribute fixed
|
26
|
-
# @return
|
26
|
+
# @return String, nil
|
27
27
|
property :fixed, :string
|
28
28
|
|
29
29
|
# Optional. Specifies the form for the attribute. The default value is the value of the attributeFormDefault
|
@@ -33,14 +33,14 @@ module XSD
|
|
33
33
|
# unqualified - indicates that this attribute is not required to be qualified with the namespace prefix and is
|
34
34
|
# matched against the (NCName) of the attribute
|
35
35
|
# @!attribute form
|
36
|
-
# @return
|
36
|
+
# @return String, nil
|
37
37
|
# TODO: поддержка default значения с вычислением родителя
|
38
38
|
property :form, :string
|
39
39
|
|
40
40
|
# Optional. Specifies a built-in data type or a simple type. The type attribute can only be present when the
|
41
41
|
# content does not contain a simpleType element
|
42
42
|
# @!attribute type
|
43
|
-
# @return
|
43
|
+
# @return String, nil
|
44
44
|
property :type, :string
|
45
45
|
|
46
46
|
# Optional. Specifies how the attribute is used. Can be one of the following values:
|
@@ -48,23 +48,23 @@ module XSD
|
|
48
48
|
# prohibited - the attribute cannot be used
|
49
49
|
# required - the attribute is required
|
50
50
|
# @!attribute use
|
51
|
-
# @return
|
51
|
+
# @return String
|
52
52
|
property :use, :string, default: 'optional'
|
53
53
|
|
54
54
|
# Determine if attribute is required
|
55
|
-
# @return
|
55
|
+
# @return Boolean
|
56
56
|
def required?
|
57
57
|
use == 'required'
|
58
58
|
end
|
59
59
|
|
60
60
|
# Determine if attribute is optional
|
61
|
-
# @return
|
61
|
+
# @return Boolean
|
62
62
|
def optional?
|
63
63
|
use == 'optional'
|
64
64
|
end
|
65
65
|
|
66
66
|
# Determine if attribute is prohibited
|
67
|
-
# @return
|
67
|
+
# @return Boolean
|
68
68
|
def prohibited?
|
69
69
|
use == 'prohibited'
|
70
70
|
end
|
data/lib/xsd/objects/choice.rb
CHANGED
@@ -12,22 +12,22 @@ module XSD
|
|
12
12
|
|
13
13
|
# Nested groups
|
14
14
|
# @!attribute groups
|
15
|
-
# @return
|
15
|
+
# @return Array<Group>
|
16
16
|
child :groups, [:group]
|
17
17
|
|
18
18
|
# Nested choices
|
19
19
|
# @!attribute choices
|
20
|
-
# @return
|
20
|
+
# @return Array<Choice>
|
21
21
|
child :choices, [:choice]
|
22
22
|
|
23
23
|
# Nested sequences
|
24
24
|
# @!attribute sequences
|
25
|
-
# @return
|
25
|
+
# @return Array<Sequence>
|
26
26
|
child :sequences, [:sequence]
|
27
27
|
|
28
28
|
# Nested anys
|
29
29
|
# @!attribute anys
|
30
|
-
# @return
|
30
|
+
# @return Array<Any>
|
31
31
|
child :anys, [:any]
|
32
32
|
end
|
33
33
|
end
|
@@ -9,17 +9,17 @@ module XSD
|
|
9
9
|
# Optional. Specifies whether character data is allowed to appear between the child elements of this complexType
|
10
10
|
# element. Default is false
|
11
11
|
# @!attribute mixed
|
12
|
-
# @return
|
12
|
+
# @return Boolean
|
13
13
|
property :mixed, :boolean, default: false
|
14
14
|
|
15
15
|
# Get nested extension
|
16
16
|
# @!attribute extension
|
17
|
-
# @return
|
17
|
+
# @return Extension, nil
|
18
18
|
child :extension, :extension
|
19
19
|
|
20
20
|
# Get nested restriction
|
21
21
|
# @!attribute restriction
|
22
|
-
# @return
|
22
|
+
# @return Restriction, nil
|
23
23
|
child :restriction, :restriction
|
24
24
|
end
|
25
25
|
end
|
@@ -10,19 +10,19 @@ module XSD
|
|
10
10
|
|
11
11
|
# Optional. Specifies the name of the attribute. Name and ref attributes cannot both be present
|
12
12
|
# @!attribute name
|
13
|
-
# @return
|
13
|
+
# @return String
|
14
14
|
property :name, :string
|
15
15
|
|
16
16
|
# Optional. Specifies whether the complex type can be used in an instance document. True indicates that an element
|
17
17
|
# cannot use this complex type directly but must use a complex type derived from this complex type. Default is false
|
18
18
|
# @!attribute abstract
|
19
|
-
# @return
|
19
|
+
# @return Boolean
|
20
20
|
property :abstract, :boolean, default: false
|
21
21
|
|
22
22
|
# Optional. Specifies whether character data is allowed to appear between the child elements of this complexType
|
23
23
|
# element. Default is false. If a simpleContent element is a child element, the mixed attribute is not allowed!
|
24
24
|
# @!attribute mixed
|
25
|
-
# @return
|
25
|
+
# @return Boolean
|
26
26
|
property :mixed, :boolean, default: false
|
27
27
|
|
28
28
|
# Optional. Prevents a complex type that has a specified type of derivation from being used in place of this
|
@@ -31,7 +31,7 @@ module XSD
|
|
31
31
|
# restriction - prevents complex types derived by restriction
|
32
32
|
# #all - prevents all derived complex types
|
33
33
|
# @!attribute block
|
34
|
-
# @return
|
34
|
+
# @return String, nil
|
35
35
|
property :block, :string
|
36
36
|
|
37
37
|
# Optional. Prevents a specified type of derivation of this complex type element. Can contain #all or a list
|
@@ -40,41 +40,41 @@ module XSD
|
|
40
40
|
# restriction - prevents derivation by restriction
|
41
41
|
# #all - prevents all derivation
|
42
42
|
# @!attribute final
|
43
|
-
# @return
|
43
|
+
# @return String, nil
|
44
44
|
property :final, :string
|
45
45
|
|
46
46
|
# Simple content object
|
47
47
|
# @!attribute simple_content
|
48
|
-
# @return
|
48
|
+
# @return SimpleContent
|
49
49
|
child :simple_content, :simpleContent
|
50
50
|
|
51
51
|
# Complex content object
|
52
52
|
# @!attribute complex_content
|
53
|
-
# @return
|
53
|
+
# @return ComplexContent
|
54
54
|
child :complex_content, :complexContent
|
55
55
|
|
56
56
|
# Nested group
|
57
57
|
# @!attribute group
|
58
|
-
# @return
|
58
|
+
# @return Group
|
59
59
|
child :group, :group
|
60
60
|
|
61
61
|
# Nested all
|
62
62
|
# @!attribute all
|
63
|
-
# @return
|
63
|
+
# @return All
|
64
64
|
child :all, :all
|
65
65
|
|
66
66
|
# Nested choice
|
67
67
|
# @!attribute choice
|
68
|
-
# @return
|
68
|
+
# @return Choice
|
69
69
|
child :choice, :choice
|
70
70
|
|
71
71
|
# Nested sequence
|
72
72
|
# @!attribute sequence
|
73
|
-
# @return
|
73
|
+
# @return Sequence
|
74
74
|
child :sequence, :sequence
|
75
75
|
|
76
76
|
# Determine if this is a linked type
|
77
|
-
# @return
|
77
|
+
# @return Boolean
|
78
78
|
def linked?
|
79
79
|
!name.nil?
|
80
80
|
end
|
@@ -7,12 +7,12 @@ module XSD
|
|
7
7
|
class Documentation < BaseObject
|
8
8
|
# Optional. A URI reference that specifies the source of the application information
|
9
9
|
# @!attribute source
|
10
|
-
# @return
|
10
|
+
# @return String
|
11
11
|
property :source, :string
|
12
12
|
|
13
13
|
# Optional. Specifies the language used in the contents
|
14
14
|
# @!attribute xml_lang
|
15
|
-
# @return
|
15
|
+
# @return String
|
16
16
|
property :'xml:lang', :string
|
17
17
|
end
|
18
18
|
end
|