xsd 2.7.5 → 2.7.7
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 +3 -1
- data/lib/xsd/objects/element.rb +21 -7
- data/lib/xsd/shared/min_max_occurs.rb +6 -0
- 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: 8d62fa4aab11649bbbb36686518037701a98f8b0f6c7a553e4c6925eecf2f5eb
|
4
|
+
data.tar.gz: 9f75202ed5c7945d6667e81f3c5044fb2442c64294412a7a25a73cadd6993829
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8749bf41fa3a2449e2cec62d8d657fff5e69458e59dbb8fa2a8a93945f6cda96d704d269a39fe03b521f95ba7b7b25ca4d14061fad38e4172dea4f07d59f1844
|
7
|
+
data.tar.gz: 57160d2965a6281b7faace74f9e556d1fd78d4adce27f8b1fafd241ad979860c68560a67cbd4adaecbb69851bf47e58297bb53da6e460a5466a9b29732227494
|
data/CHANGELOG.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
|
-
## [2.7.
|
1
|
+
## [2.7.7] - 2024-04-22
|
2
2
|
|
3
3
|
- Return <xs:any> and <xs:anyAttribute> from collect_elements/collect_attributes
|
4
4
|
- Make multiple_allowed? available on all definitions with max occurs
|
5
5
|
- Don't return duplicated attributes from complex restriction
|
6
6
|
- Fix base_complex_type on restriction without base
|
7
|
+
- Improve substitutable elements detection
|
8
|
+
- Added mutiple? shorthand
|
7
9
|
|
8
10
|
## [2.6.3] - 2024-04-13
|
9
11
|
|
data/lib/xsd/objects/element.rb
CHANGED
@@ -130,14 +130,28 @@ module XSD
|
|
130
130
|
complex_type&.mixed_content? || false
|
131
131
|
end
|
132
132
|
|
133
|
-
# Get elements
|
133
|
+
# Get substitutable elements
|
134
134
|
# @return Array<Element>
|
135
|
-
def
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
135
|
+
def substitutable_elements
|
136
|
+
@substitutable_elements ||= begin
|
137
|
+
if ref
|
138
|
+
reference.substitutable_elements
|
139
|
+
elsif !global? || %w[#all substitution].include?(block)
|
140
|
+
[]
|
141
|
+
else
|
142
|
+
# TODO: we search substituted element only in the same schema with head element, is this enough?
|
143
|
+
# TODO: maybe don't collect all elements but search with xpath first?
|
144
|
+
schema.collect_elements.select do |element|
|
145
|
+
strip_prefix(element.substitution_group) == name
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
# Check is this attribute is global (immediate child of schema element)
|
152
|
+
# @return Boolean
|
153
|
+
def global?
|
154
|
+
parent.is_a?(Schema)
|
141
155
|
end
|
142
156
|
|
143
157
|
# Get base data type
|
@@ -45,6 +45,12 @@ module XSD
|
|
45
45
|
|
46
46
|
# Determine if element may occur multiple times
|
47
47
|
# @return Boolean
|
48
|
+
def multiple?
|
49
|
+
max_occurs == :unbounded || max_occurs > 1
|
50
|
+
end
|
51
|
+
|
52
|
+
# Determine if element may occur multiple times, accounting parents
|
53
|
+
# @return Boolean
|
48
54
|
def multiple_allowed?
|
49
55
|
computed_max_occurs == :unbounded || computed_max_occurs > 1
|
50
56
|
end
|
data/lib/xsd/version.rb
CHANGED