xmi 0.7.9 → 0.7.10

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: a8a81782835004c81530959613cddd83ccb54b4ed53d99802ba490120deb66b8
4
- data.tar.gz: 1515e17a72558e63119e9ccbe55ef199a4a5d11aec6d2c2e80f5b4da60e1350a
3
+ metadata.gz: 5cdd7b58d5eec786449bd80d7407ceeb1823db69b1d3c55043b833d6182f2623
4
+ data.tar.gz: 3bca0251414a18e912f4beda536c3c5dd4d8a09f53943f762eddb8a18fa45d67
5
5
  SHA512:
6
- metadata.gz: 6bcd92c05733da729a623c46846266b31470a83c03125de54f940e01ccf5d50873fdda387d28f4265a1b15065a18166aa2946ff6cac830c37bf10ed3b463d51b
7
- data.tar.gz: 20350942334e4ff57197351f2a290bdd919958b86622c61f6a68cde563dd93cfdba4b5c8ec3a371169fe852876bba97ee30865c49b6ad05d9ce3d2b31a759f67
6
+ metadata.gz: 20b078514ff3559c7b7527c0528d5153b11f2ed13532cef765e77359a69e10f1eb3b923be935c67c37f926e3e5f9ba4394477ba684e50f501b19ca42aaace13e
7
+ data.tar.gz: d5851c9cd91c3590384f3741aee6a85c13b27f1a1377650182989e0c92a847361d2dcbf538dbe105ecb35042828b15ce162dbf657af972cf0c85ed9ec3dbc395
@@ -6,6 +6,7 @@ permissions:
6
6
  contents: write
7
7
  packages: write
8
8
  id-token: write
9
+ pull-requests: write
9
10
 
10
11
  on:
11
12
  workflow_dispatch:
@@ -27,3 +28,4 @@ jobs:
27
28
  next_version: ${{ github.event.inputs.next_version }}
28
29
  secrets:
29
30
  rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
31
+ pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
@@ -29,13 +29,13 @@ module Xmi
29
29
  )
30
30
 
31
31
  # Without baseStereotypes
32
- nodes.select { |n| n.attributes["baseStereotypes"].nil? }.each do |node|
32
+ nodes.select { |n| n["baseStereotypes"].nil? }.each do |node|
33
33
  build_stereotype_class(mod, node, abstract_klass, ns_class)
34
34
  end
35
35
 
36
36
  # With baseStereotypes
37
- nodes.reject { |n| n.attributes["baseStereotypes"].nil? }.each do |node|
38
- base_name = node.attributes["baseStereotypes"].value
37
+ nodes.reject { |n| n["baseStereotypes"].nil? }.each do |node|
38
+ base_name = node["baseStereotypes"]
39
39
  build_stereotype_class(mod, node, abstract_klass, ns_class,
40
40
  parent_name: base_name)
41
41
  end
@@ -96,7 +96,7 @@ module Xmi
96
96
 
97
97
  # Add apply type attributes
98
98
  apply_nodes.each do |n|
99
- apply_types = n.attribute_nodes.map(&:value)
99
+ apply_types = n.attributes.map(&:value)
100
100
  apply_types.each do |apply_type|
101
101
  attr_name = Lutaml::Model::Utils.snake_case("base_#{apply_type}")
102
102
  klass.attribute attr_name.to_sym, :string
@@ -112,7 +112,7 @@ module Xmi
112
112
 
113
113
  apply_pairs = []
114
114
  apply_nodes.each do |n|
115
- n.attribute_nodes.map(&:value).each do |apply_type|
115
+ n.attributes.map(&:value).each do |apply_type|
116
116
  apply_pairs << [
117
117
  "base_#{apply_type}",
118
118
  Lutaml::Model::Utils.snake_case("base_#{apply_type}").to_sym,
@@ -12,7 +12,7 @@ module Xmi
12
12
  def get_klass_name_from_node(node)
13
13
  return Lutaml::Model::Serializable.to_s unless node
14
14
 
15
- node.attribute_nodes.find { |attr| attr.name == "name" }.value
15
+ node["name"]
16
16
  end
17
17
 
18
18
  def get_module_name(xmi_doc)
@@ -21,16 +21,16 @@ module Xmi
21
21
 
22
22
  def get_module_name_from_definition(xmi_doc)
23
23
  node = xmi_doc.at_xpath("//UMLProfile/Documentation")
24
- node.attribute_nodes.find { |attr| attr.name == "name" }&.value
24
+ node["name"]
25
25
  end
26
26
 
27
27
  def get_module_uri(xmi_doc)
28
28
  node = xmi_doc.at_xpath("//UMLProfile/Documentation")
29
- uri = node.attribute_nodes.find { |attr| attr.name == "URI" }&.value
29
+ uri = node["URI"]
30
30
  return uri if uri
31
31
 
32
32
  name = get_module_name_from_definition(xmi_doc)
33
- ver = node.attribute_nodes.find { |attr| attr.name == "version" }&.value
33
+ ver = node["version"]
34
34
 
35
35
  "http://www.sparxsystems.com/profiles/#{name}/#{ver}"
36
36
  end
@@ -43,7 +43,7 @@ module Xmi
43
43
  end
44
44
 
45
45
  def get_tag_name(tag)
46
- tag_name = tag.attribute_nodes.find { |attr| attr.name == "name" }.value
46
+ tag_name = tag["name"]
47
47
  tag_name == "xmlns" ? "altered_xmlns" : tag_name
48
48
  end
49
49
  end
data/lib/xmi/ea_root.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "nokogiri"
3
+ require "moxml"
4
4
 
5
5
  module Xmi
6
6
  class EaRoot
@@ -19,7 +19,7 @@ module Xmi
19
19
 
20
20
  class << self
21
21
  def load_extension(xml_path)
22
- xmi_doc = Nokogiri::XML(File.read(xml_path))
22
+ xmi_doc = Moxml.parse(File.read(xml_path))
23
23
  extension_id = get_module_name(xmi_doc)
24
24
 
25
25
  if loaded_extensions.key?(extension_id)
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "nokogiri"
3
+ require "moxml"
4
4
 
5
5
  module Xmi
6
6
  # Detects namespace versions from XMI XML content
@@ -44,7 +44,7 @@ module Xmi
44
44
 
45
45
  # Extract all namespace URIs from XML content using regex on the first 8KB.
46
46
  #
47
- # This avoids a full Nokogiri parse — namespace declarations are always
47
+ # This avoids a full XML parse — namespace declarations are always
48
48
  # on or near the root element, so scanning the first few KB is sufficient
49
49
  # and ~10x faster than parsing a 3.5MB document.
50
50
  #
@@ -64,15 +64,20 @@ module Xmi
64
64
  result
65
65
  end
66
66
 
67
- # Extract namespace URIs via Nokogiri (full parse).
67
+ # Extract namespace URIs via a full parse.
68
68
  # Used by `analyze` when the complete namespace map is needed.
69
69
  #
70
70
  # @param xml_content [String] The XML content
71
71
  # @return [Hash<String, String>] A hash mapping prefixes to namespace URIs
72
72
  def self.extract_namespace_uris_full(xml_content)
73
- doc = Nokogiri::XML(xml_content, &:noent)
74
- doc.collect_namespaces
75
- rescue Nokogiri::XML::SyntaxError
73
+ # Nokogiri tolerated invalid byte sequences; Moxml adapters are
74
+ # strict. Namespaces are ASCII, so replacement bytes are inert.
75
+ xml = xml_content.encode("UTF-8", invalid: :replace, undef: :replace)
76
+ doc = Moxml.parse(xml)
77
+ Array(doc.root.namespaces).each_with_object({}) do |ns, result|
78
+ result[ns.prefix.nil? ? "xmlns" : "xmlns:#{ns.prefix}"] = ns.uri
79
+ end
80
+ rescue Moxml::ParseError
76
81
  {}
77
82
  end
78
83
 
data/lib/xmi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Xmi
4
- VERSION = "0.7.9"
4
+ VERSION = "0.7.10"
5
5
  end
data/xmi.gemspec CHANGED
@@ -35,5 +35,11 @@ Gem::Specification.new do |spec|
35
35
  # OwnedParameter's namespace-disjoint xmi:type vs type slots need
36
36
  # lutaml-model >= 0.8.53 (attribute parsing by (URI, local name)).
37
37
  spec.add_dependency "lutaml-model", "~> 0.8.159"
38
- spec.add_dependency "nokogiri", "~> 1.19"
38
+ spec.add_dependency "moxml", "~> 0.6"
39
+
40
+ # The EA-parity spec suite pins lutaml-model to the nokogiri adapter
41
+ # (the reference implementation; see spec/spec_helper.rb). Runtime
42
+ # code paths use moxml only - nokogiri is not a runtime dependency.
43
+ spec.add_development_dependency "nokogiri", "~> 1.19"
44
+
39
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xmi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.9
4
+ version: 0.7.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ribose Inc.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-11-03 00:00:00.000000000 Z
11
+ date: 2026-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: lutaml-model
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.8.159
27
+ - !ruby/object:Gem::Dependency
28
+ name: moxml
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.6'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.6'
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: nokogiri
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -31,7 +45,7 @@ dependencies:
31
45
  - - "~>"
32
46
  - !ruby/object:Gem::Version
33
47
  version: '1.19'
34
- type: :runtime
48
+ type: :development
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements: