xsd 2.6.0 → 2.6.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/xsd/base_object.rb +21 -18
- data/lib/xsd/objects/attribute.rb +3 -4
- data/lib/xsd/objects/element.rb +1 -1
- data/lib/xsd/objects/group.rb +2 -1
- data/lib/xsd/shared/named.rb +2 -1
- data/lib/xsd/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d3f894631bb4ecfab0ab93c8b67f1a4d2d85dc88aeef5c69890e424c018ea7a0
|
4
|
+
data.tar.gz: 6be2dfdee0a06f955d80ba57cbc39739fa6c09c06d6af80d194e77ccf32c8797
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7d45a0c77011c0bdfd4bdee3998eef649129cb51d2c248b733a35b9c2c19bb8678b2b41035afcc95f69f02e37df550bd90ef5c57a03225789de34ff7dfb65c11
|
7
|
+
data.tar.gz: dd2673d5e862524a8fad13f8ce55857d9ec3c7daed215542b9806491c428e778ce011b77c26f2dc3aa6ba24a60bfd5d1bdf9ed6cc59a702ac4daa23725fa9dce
|
data/CHANGELOG.md
CHANGED
data/lib/xsd/base_object.rb
CHANGED
@@ -304,20 +304,24 @@ module XSD
|
|
304
304
|
# check for property first
|
305
305
|
if (property = self.class.properties[method])
|
306
306
|
value = property[:resolve] ? property[:resolve].call(self) : node[property[:name].to_s]
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
307
|
+
r = if value.nil?
|
308
|
+
if node['ref']
|
309
|
+
# if object has reference - search property in referenced object
|
310
|
+
reference.send(method, *args)
|
311
|
+
else
|
312
|
+
property[:default].is_a?(Proc) ? instance_eval(&property[:default]) : property[:default]
|
313
|
+
end
|
314
|
+
else
|
315
|
+
case property[:type]
|
316
|
+
when :integer
|
317
|
+
property[:name] == :maxOccurs && value == 'unbounded' ? :unbounded : value.to_i
|
318
|
+
when :boolean
|
319
|
+
value == 'true'
|
320
|
+
else
|
321
|
+
value
|
322
|
+
end
|
323
|
+
end
|
324
|
+
return @cache[method] = r
|
321
325
|
end
|
322
326
|
|
323
327
|
# if object has ref it cannot contain any type and children, so proxy call to target object
|
@@ -375,20 +379,19 @@ module XSD
|
|
375
379
|
private
|
376
380
|
|
377
381
|
def definition_match?(definition, query)
|
378
|
-
|
379
|
-
|
382
|
+
# namespace included in query
|
380
383
|
if query.start_with?('{')
|
381
384
|
parts = query[1..].split('}')
|
382
385
|
raise Error, "Invalid element/attribute query: #{query}" if parts.size != 2
|
383
386
|
|
384
387
|
namespace, name = parts
|
385
388
|
|
386
|
-
return false if namespace !=
|
389
|
+
return false if namespace != definition.namespace
|
387
390
|
else
|
388
391
|
name = query
|
389
392
|
end
|
390
393
|
|
391
|
-
name == '*' ||
|
394
|
+
name == '*' || definition.name == name
|
392
395
|
end
|
393
396
|
end
|
394
397
|
end
|
@@ -28,15 +28,14 @@ module XSD
|
|
28
28
|
property :fixed, :string
|
29
29
|
|
30
30
|
# Optional. Specifies the form for the attribute. The default value is the value of the attributeFormDefault
|
31
|
-
# attribute of the
|
31
|
+
# attribute of the schema containing the attribute. Can be set to one of the following:
|
32
32
|
# qualified - indicates that this attribute must be qualified with the namespace prefix and the no-colon-name
|
33
33
|
# (NCName) of the attribute
|
34
34
|
# unqualified - indicates that this attribute is not required to be qualified with the namespace prefix and is
|
35
35
|
# matched against the (NCName) of the attribute
|
36
36
|
# @!attribute form
|
37
|
-
# @return String
|
38
|
-
|
39
|
-
property :form, :string
|
37
|
+
# @return String
|
38
|
+
property :form, :string, default: proc { schema.attribute_form_default }
|
40
39
|
|
41
40
|
# Optional. Specifies a built-in data type or a simple type. The type attribute can only be present when the
|
42
41
|
# content does not contain a simpleType element
|
data/lib/xsd/objects/element.rb
CHANGED
@@ -47,7 +47,7 @@ module XSD
|
|
47
47
|
# cannot be used if the parent element is the schema element
|
48
48
|
# @!attribute form
|
49
49
|
# @return String
|
50
|
-
property :form, :string
|
50
|
+
property :form, :string, default: proc { schema.element_form_default }
|
51
51
|
|
52
52
|
# Optional. Specifies whether an explicit null value can be assigned to the element. True enables an instance of
|
53
53
|
# the element to have the null attribute set to true. The null attribute is defined as part of the XML Schema
|
data/lib/xsd/objects/group.rb
CHANGED
@@ -8,8 +8,9 @@ module XSD
|
|
8
8
|
class Group < BaseObject
|
9
9
|
include MinMaxOccurs
|
10
10
|
include Referenced
|
11
|
+
include Named
|
11
12
|
|
12
|
-
# Optional. Specifies
|
13
|
+
# Optional. Specifies a name for the group. This attribute is used only when the schema element is the parent of this group element. Name and ref attributes cannot both be present
|
13
14
|
# @!attribute name
|
14
15
|
# @return String
|
15
16
|
property :name, :string
|
data/lib/xsd/shared/named.rb
CHANGED
@@ -5,7 +5,8 @@ module XSD
|
|
5
5
|
# Get definition namespace
|
6
6
|
# @return String
|
7
7
|
def namespace
|
8
|
-
|
8
|
+
is_referenced = respond_to?(:referenced?)
|
9
|
+
is_referenced && referenced? ? reference.schema.target_namespace : schema.target_namespace
|
9
10
|
end
|
10
11
|
|
11
12
|
# Get absolute definition name
|
data/lib/xsd/version.rb
CHANGED