xsd 2.9.0 → 2.9.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6dafeffb7f25c0134087002cfa7a33a2ae26bfb5d7aefc83dd998f73ce6551ce
4
- data.tar.gz: 309a398a467318eb24d8912556010c11cba92f72419088b709540775dc270e00
3
+ metadata.gz: 90d2e1e3950f8ada667ad7a2960940c3a4857918425c6fb54ef6c6a92702f1bc
4
+ data.tar.gz: 713e112c94582f982c01708d6ca735fd667006b476cb6ef0125383c55e39644b
5
5
  SHA512:
6
- metadata.gz: 292b2948f27d88c4363149e41aabca8858cd3c9105b804c5e85231135f1deb9d1a2bab10a6868839721dfd866b75a6579aca43d9243ca115dd752597cbaa7d81
7
- data.tar.gz: cdc5245afa7c4fd48064b8c6ddac6966d8e0010d8a98e23fc59b43eb3df98e2159f4912db2e4ca3c5610e7713f0af1d525b6137e1c5c74edd38b8d87896c0717
6
+ metadata.gz: a804d3750423fe3c04c5d99614dac7a49679941498dacb9e9f72ef319c99da2c21ab70e94df58e38e7d0bae59561c66836c81db7df651ca68030baf363c96eab
7
+ data.tar.gz: 7ed63b4341d8a27a6fc1b3df4d3c6aebd30a2a5e101bf91ccaa32b54997b47f475d98c329c406eb5802706d4361b9ef6dc119a6422922726234391d124a202b2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [2.9.1] - 2026-10-20
2
+
3
+ ### Changed
4
+
5
+ - A reference by name (a `type`, `ref`, `base`, …) is looked up in an index of the schema's top-level declarations
6
+ (`Schema#declaration_node`), built on the first lookup, instead of an XPath query that scanned every child of the
7
+ schema again for each reference. Large schemas referenced thousands of times are read several times faster
8
+ there; what is found is the same.
9
+ - The specs no longer load `wasabi`, which only a commented-out example used and which does not load on Ruby 3.4
10
+ (it requires `kconv`): the suite runs on Ruby 3.4.
11
+
1
12
  ## [2.9.0] - 2026-10-18
2
13
 
3
14
  ### Changed
data/Gemfile CHANGED
@@ -12,5 +12,4 @@ group :development do
12
12
  gem 'rubocop-performance', '~> 1.17'
13
13
  gem 'rubocop-rake', '~> 0.6'
14
14
  gem 'rubocop-rspec', '~> 2.10'
15
- gem 'wasabi', '~> 4.0'
16
15
  end
@@ -129,9 +129,9 @@ module XSD
129
129
  # determine schema for namespace
130
130
  search_schemas = schemas_for_namespace(name_prefix)
131
131
 
132
- # find element in target schema, name is passed as an xpath variable to stay safe with any name contents
132
+ # find the declaration in the schemas of the namespace
133
133
  search_schemas.each do |s|
134
- node = s.node.at_xpath("./xs:#{node_name}[@name=$name]", XML_SCHEMA_NS, name: name_local)
134
+ node = s.declaration_node(node_name, name_local)
135
135
  return s.node_to_object(node) if node
136
136
  end
137
137
 
@@ -127,6 +127,22 @@ module XSD
127
127
  chameleon? ? (@object_cache ||= {}.compare_by_identity) : reader.object_cache
128
128
  end
129
129
 
130
+ # The node of a top-level declaration of this schema, by its kind and name — what a reference by name looks up
131
+ # (BaseObject#object_by_name). The children are indexed in one pass on the first lookup: a query per lookup
132
+ # scans all of them again, and a large schema is looked up in once for every reference to it.
133
+ # @param [Symbol, String] node_name kind of declaration: complexType, simpleType, element, group, ...
134
+ # @param [String] name local name
135
+ # @return Nokogiri::XML::Element, nil
136
+ def declaration_node(node_name, name)
137
+ @declaration_nodes ||= node.element_children.each_with_object({}) do |child, index|
138
+ next unless child.namespace&.href == XML_SCHEMA
139
+
140
+ # the first one, as a query would find it
141
+ index[[child.name, child['name']]] ||= child
142
+ end
143
+ @declaration_nodes[[node_name.to_s, name]]
144
+ end
145
+
130
146
  # This schema and every schema it includes, those included in turn too
131
147
  # @return Array<Schema>
132
148
  def with_includes
data/lib/xsd/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module XSD
4
- VERSION = '2.9.0'
4
+ VERSION = '2.9.1'
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xsd
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.9.0
4
+ version: 2.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - d.arkhipov
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-10-19 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: builder
@@ -119,7 +118,6 @@ metadata:
119
118
  homepage_uri: https://github.com/ekzo-dev/ruby-xsd
120
119
  source_code_uri: https://github.com/ekzo-dev/ruby-xsd
121
120
  changelog_uri: https://github.com/ekzo-dev/ruby-xsd/blob/main/CHANGELOG.md
122
- post_install_message:
123
121
  rdoc_options: []
124
122
  require_paths:
125
123
  - lib
@@ -134,8 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
132
  - !ruby/object:Gem::Version
135
133
  version: '0'
136
134
  requirements: []
137
- rubygems_version: 3.5.5
138
- signing_key:
135
+ rubygems_version: 3.6.9
139
136
  specification_version: 4
140
137
  summary: The Ruby XSD library is an XML Schema implementation for Ruby.
141
138
  test_files: []