moxml 0.1.7 → 0.1.8

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.
Files changed (212) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/dependent-repos.json +5 -0
  3. data/.github/workflows/dependent-tests.yml +20 -0
  4. data/.github/workflows/docs.yml +59 -0
  5. data/.github/workflows/rake.yml +10 -10
  6. data/.github/workflows/release.yml +5 -3
  7. data/.gitignore +37 -0
  8. data/.rubocop.yml +15 -7
  9. data/.rubocop_todo.yml +238 -40
  10. data/Gemfile +14 -9
  11. data/LICENSE.md +6 -2
  12. data/README.adoc +535 -373
  13. data/Rakefile +53 -0
  14. data/benchmarks/.gitignore +6 -0
  15. data/benchmarks/generate_report.rb +550 -0
  16. data/docs/Gemfile +13 -0
  17. data/docs/_config.yml +138 -0
  18. data/docs/_guides/advanced-features.adoc +87 -0
  19. data/docs/_guides/development-testing.adoc +165 -0
  20. data/docs/_guides/index.adoc +45 -0
  21. data/docs/_guides/modifying-xml.adoc +293 -0
  22. data/docs/_guides/parsing-xml.adoc +231 -0
  23. data/docs/_guides/sax-parsing.adoc +603 -0
  24. data/docs/_guides/working-with-documents.adoc +118 -0
  25. data/docs/_pages/adapter-compatibility.adoc +369 -0
  26. data/docs/_pages/adapters/headed-ox.adoc +237 -0
  27. data/docs/_pages/adapters/index.adoc +98 -0
  28. data/docs/_pages/adapters/libxml.adoc +286 -0
  29. data/docs/_pages/adapters/nokogiri.adoc +252 -0
  30. data/docs/_pages/adapters/oga.adoc +292 -0
  31. data/docs/_pages/adapters/ox.adoc +55 -0
  32. data/docs/_pages/adapters/rexml.adoc +293 -0
  33. data/docs/_pages/best-practices.adoc +430 -0
  34. data/docs/_pages/compatibility.adoc +468 -0
  35. data/docs/_pages/configuration.adoc +251 -0
  36. data/docs/_pages/error-handling.adoc +350 -0
  37. data/docs/_pages/headed-ox-limitations.adoc +558 -0
  38. data/docs/_pages/headed-ox.adoc +1025 -0
  39. data/docs/_pages/index.adoc +35 -0
  40. data/docs/_pages/installation.adoc +141 -0
  41. data/docs/_pages/node-api-reference.adoc +50 -0
  42. data/docs/_pages/performance.adoc +36 -0
  43. data/docs/_pages/quick-start.adoc +244 -0
  44. data/docs/_pages/thread-safety.adoc +29 -0
  45. data/docs/_references/document-api.adoc +408 -0
  46. data/docs/_references/index.adoc +48 -0
  47. data/docs/_tutorials/basic-usage.adoc +268 -0
  48. data/docs/_tutorials/builder-pattern.adoc +343 -0
  49. data/docs/_tutorials/index.adoc +33 -0
  50. data/docs/_tutorials/namespace-handling.adoc +325 -0
  51. data/docs/_tutorials/xpath-queries.adoc +359 -0
  52. data/docs/index.adoc +122 -0
  53. data/examples/README.md +124 -0
  54. data/examples/api_client/README.md +424 -0
  55. data/examples/api_client/api_client.rb +394 -0
  56. data/examples/api_client/example_response.xml +48 -0
  57. data/examples/headed_ox_example/README.md +90 -0
  58. data/examples/headed_ox_example/headed_ox_demo.rb +71 -0
  59. data/examples/rss_parser/README.md +194 -0
  60. data/examples/rss_parser/example_feed.xml +93 -0
  61. data/examples/rss_parser/rss_parser.rb +189 -0
  62. data/examples/sax_parsing/README.md +50 -0
  63. data/examples/sax_parsing/data_extractor.rb +75 -0
  64. data/examples/sax_parsing/example.xml +21 -0
  65. data/examples/sax_parsing/large_file.rb +78 -0
  66. data/examples/sax_parsing/simple_parser.rb +55 -0
  67. data/examples/web_scraper/README.md +352 -0
  68. data/examples/web_scraper/example_page.html +201 -0
  69. data/examples/web_scraper/web_scraper.rb +312 -0
  70. data/lib/moxml/adapter/base.rb +107 -28
  71. data/lib/moxml/adapter/customized_libxml/cdata.rb +28 -0
  72. data/lib/moxml/adapter/customized_libxml/comment.rb +24 -0
  73. data/lib/moxml/adapter/customized_libxml/declaration.rb +85 -0
  74. data/lib/moxml/adapter/customized_libxml/element.rb +39 -0
  75. data/lib/moxml/adapter/customized_libxml/node.rb +44 -0
  76. data/lib/moxml/adapter/customized_libxml/processing_instruction.rb +31 -0
  77. data/lib/moxml/adapter/customized_libxml/text.rb +27 -0
  78. data/lib/moxml/adapter/customized_oga/xml_generator.rb +1 -1
  79. data/lib/moxml/adapter/customized_ox/attribute.rb +28 -1
  80. data/lib/moxml/adapter/customized_rexml/formatter.rb +11 -6
  81. data/lib/moxml/adapter/headed_ox.rb +161 -0
  82. data/lib/moxml/adapter/libxml.rb +1548 -0
  83. data/lib/moxml/adapter/nokogiri.rb +121 -9
  84. data/lib/moxml/adapter/oga.rb +123 -12
  85. data/lib/moxml/adapter/ox.rb +282 -26
  86. data/lib/moxml/adapter/rexml.rb +127 -20
  87. data/lib/moxml/adapter.rb +21 -4
  88. data/lib/moxml/attribute.rb +6 -0
  89. data/lib/moxml/builder.rb +40 -4
  90. data/lib/moxml/config.rb +8 -3
  91. data/lib/moxml/context.rb +39 -1
  92. data/lib/moxml/doctype.rb +13 -1
  93. data/lib/moxml/document.rb +39 -6
  94. data/lib/moxml/document_builder.rb +27 -5
  95. data/lib/moxml/element.rb +71 -2
  96. data/lib/moxml/error.rb +175 -6
  97. data/lib/moxml/node.rb +94 -3
  98. data/lib/moxml/node_set.rb +34 -0
  99. data/lib/moxml/sax/block_handler.rb +194 -0
  100. data/lib/moxml/sax/element_handler.rb +124 -0
  101. data/lib/moxml/sax/handler.rb +113 -0
  102. data/lib/moxml/sax.rb +31 -0
  103. data/lib/moxml/version.rb +1 -1
  104. data/lib/moxml/xml_utils/encoder.rb +4 -4
  105. data/lib/moxml/xml_utils.rb +7 -4
  106. data/lib/moxml/xpath/ast/node.rb +159 -0
  107. data/lib/moxml/xpath/cache.rb +91 -0
  108. data/lib/moxml/xpath/compiler.rb +1768 -0
  109. data/lib/moxml/xpath/context.rb +26 -0
  110. data/lib/moxml/xpath/conversion.rb +124 -0
  111. data/lib/moxml/xpath/engine.rb +52 -0
  112. data/lib/moxml/xpath/errors.rb +101 -0
  113. data/lib/moxml/xpath/lexer.rb +304 -0
  114. data/lib/moxml/xpath/parser.rb +485 -0
  115. data/lib/moxml/xpath/ruby/generator.rb +269 -0
  116. data/lib/moxml/xpath/ruby/node.rb +193 -0
  117. data/lib/moxml/xpath.rb +37 -0
  118. data/lib/moxml.rb +5 -2
  119. data/moxml.gemspec +3 -1
  120. data/old-specs/moxml/adapter/customized_libxml/.gitkeep +6 -0
  121. data/spec/consistency/README.md +77 -0
  122. data/spec/{moxml/examples/adapter_spec.rb → consistency/adapter_parity_spec.rb} +4 -4
  123. data/spec/examples/README.md +75 -0
  124. data/spec/{support/shared_examples/examples/attribute.rb → examples/attribute_examples_spec.rb} +1 -1
  125. data/spec/{support/shared_examples/examples/basic_usage.rb → examples/basic_usage_spec.rb} +2 -2
  126. data/spec/{support/shared_examples/examples/namespace.rb → examples/namespace_examples_spec.rb} +3 -3
  127. data/spec/{support/shared_examples/examples/readme_examples.rb → examples/readme_examples_spec.rb} +6 -4
  128. data/spec/{support/shared_examples/examples/xpath.rb → examples/xpath_examples_spec.rb} +10 -6
  129. data/spec/integration/README.md +71 -0
  130. data/spec/{moxml/all_with_adapters_spec.rb → integration/all_adapters_spec.rb} +3 -2
  131. data/spec/integration/headed_ox_integration_spec.rb +326 -0
  132. data/spec/{support → integration}/shared_examples/edge_cases.rb +37 -10
  133. data/spec/integration/shared_examples/high_level/.gitkeep +0 -0
  134. data/spec/{support/shared_examples/context.rb → integration/shared_examples/high_level/context_behavior.rb} +2 -1
  135. data/spec/{support/shared_examples/integration.rb → integration/shared_examples/integration_workflows.rb} +23 -6
  136. data/spec/integration/shared_examples/node_wrappers/.gitkeep +0 -0
  137. data/spec/{support/shared_examples/cdata.rb → integration/shared_examples/node_wrappers/cdata_behavior.rb} +6 -1
  138. data/spec/{support/shared_examples/comment.rb → integration/shared_examples/node_wrappers/comment_behavior.rb} +2 -1
  139. data/spec/{support/shared_examples/declaration.rb → integration/shared_examples/node_wrappers/declaration_behavior.rb} +5 -2
  140. data/spec/{support/shared_examples/doctype.rb → integration/shared_examples/node_wrappers/doctype_behavior.rb} +2 -2
  141. data/spec/{support/shared_examples/document.rb → integration/shared_examples/node_wrappers/document_behavior.rb} +1 -1
  142. data/spec/{support/shared_examples/node.rb → integration/shared_examples/node_wrappers/node_behavior.rb} +9 -2
  143. data/spec/{support/shared_examples/node_set.rb → integration/shared_examples/node_wrappers/node_set_behavior.rb} +1 -18
  144. data/spec/{support/shared_examples/processing_instruction.rb → integration/shared_examples/node_wrappers/processing_instruction_behavior.rb} +6 -2
  145. data/spec/moxml/README.md +41 -0
  146. data/spec/moxml/adapter/.gitkeep +0 -0
  147. data/spec/moxml/adapter/README.md +61 -0
  148. data/spec/moxml/adapter/base_spec.rb +27 -0
  149. data/spec/moxml/adapter/headed_ox_spec.rb +311 -0
  150. data/spec/moxml/adapter/libxml_spec.rb +14 -0
  151. data/spec/moxml/adapter/ox_spec.rb +9 -8
  152. data/spec/moxml/adapter/shared_examples/.gitkeep +0 -0
  153. data/spec/{support/shared_examples/xml_adapter.rb → moxml/adapter/shared_examples/adapter_contract.rb} +39 -12
  154. data/spec/moxml/adapter_spec.rb +16 -0
  155. data/spec/moxml/attribute_spec.rb +30 -0
  156. data/spec/moxml/builder_spec.rb +33 -0
  157. data/spec/moxml/cdata_spec.rb +31 -0
  158. data/spec/moxml/comment_spec.rb +31 -0
  159. data/spec/moxml/config_spec.rb +3 -3
  160. data/spec/moxml/context_spec.rb +28 -0
  161. data/spec/moxml/declaration_spec.rb +36 -0
  162. data/spec/moxml/doctype_spec.rb +33 -0
  163. data/spec/moxml/document_builder_spec.rb +30 -0
  164. data/spec/moxml/document_spec.rb +105 -0
  165. data/spec/moxml/element_spec.rb +143 -0
  166. data/spec/moxml/error_spec.rb +266 -22
  167. data/spec/{moxml_spec.rb → moxml/moxml_spec.rb} +9 -9
  168. data/spec/moxml/namespace_spec.rb +32 -0
  169. data/spec/moxml/node_set_spec.rb +39 -0
  170. data/spec/moxml/node_spec.rb +37 -0
  171. data/spec/moxml/processing_instruction_spec.rb +34 -0
  172. data/spec/moxml/sax_spec.rb +1067 -0
  173. data/spec/moxml/text_spec.rb +31 -0
  174. data/spec/moxml/version_spec.rb +14 -0
  175. data/spec/moxml/xml_utils/.gitkeep +0 -0
  176. data/spec/moxml/xml_utils/encoder_spec.rb +27 -0
  177. data/spec/moxml/xml_utils_spec.rb +49 -0
  178. data/spec/moxml/xpath/ast/node_spec.rb +83 -0
  179. data/spec/moxml/xpath/axes_spec.rb +296 -0
  180. data/spec/moxml/xpath/cache_spec.rb +358 -0
  181. data/spec/moxml/xpath/compiler_spec.rb +406 -0
  182. data/spec/moxml/xpath/context_spec.rb +210 -0
  183. data/spec/moxml/xpath/conversion_spec.rb +365 -0
  184. data/spec/moxml/xpath/fixtures/sample.xml +25 -0
  185. data/spec/moxml/xpath/functions/boolean_functions_spec.rb +114 -0
  186. data/spec/moxml/xpath/functions/node_functions_spec.rb +145 -0
  187. data/spec/moxml/xpath/functions/numeric_functions_spec.rb +164 -0
  188. data/spec/moxml/xpath/functions/position_functions_spec.rb +93 -0
  189. data/spec/moxml/xpath/functions/special_functions_spec.rb +89 -0
  190. data/spec/moxml/xpath/functions/string_functions_spec.rb +381 -0
  191. data/spec/moxml/xpath/lexer_spec.rb +488 -0
  192. data/spec/moxml/xpath/parser_integration_spec.rb +210 -0
  193. data/spec/moxml/xpath/parser_spec.rb +364 -0
  194. data/spec/moxml/xpath/ruby/generator_spec.rb +421 -0
  195. data/spec/moxml/xpath/ruby/node_spec.rb +291 -0
  196. data/spec/moxml/xpath_capabilities_spec.rb +199 -0
  197. data/spec/moxml/xpath_spec.rb +77 -0
  198. data/spec/performance/README.md +83 -0
  199. data/spec/performance/benchmark_spec.rb +64 -0
  200. data/spec/{support/shared_examples/examples/memory.rb → performance/memory_usage_spec.rb} +3 -1
  201. data/spec/{support/shared_examples/examples/thread_safety.rb → performance/thread_safety_spec.rb} +3 -1
  202. data/spec/performance/xpath_benchmark_spec.rb +259 -0
  203. data/spec/spec_helper.rb +58 -1
  204. data/spec/support/xml_matchers.rb +1 -1
  205. metadata +176 -34
  206. data/spec/support/shared_examples/examples/benchmark_spec.rb +0 -51
  207. /data/spec/{support/shared_examples/builder.rb → integration/shared_examples/high_level/builder_behavior.rb} +0 -0
  208. /data/spec/{support/shared_examples/document_builder.rb → integration/shared_examples/high_level/document_builder_behavior.rb} +0 -0
  209. /data/spec/{support/shared_examples/attribute.rb → integration/shared_examples/node_wrappers/attribute_behavior.rb} +0 -0
  210. /data/spec/{support/shared_examples/element.rb → integration/shared_examples/node_wrappers/element_behavior.rb} +0 -0
  211. /data/spec/{support/shared_examples/namespace.rb → integration/shared_examples/node_wrappers/namespace_behavior.rb} +0 -0
  212. /data/spec/{support/shared_examples/text.rb → integration/shared_examples/node_wrappers/text_behavior.rb} +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35cf55a2fae2cbcf05a2c85a1985b1e773b8f84bca9577fc9ab237f0b9203725
4
- data.tar.gz: 8af184352fd686ac41446d225c84c93de3978220db50421b403e743ae783f727
3
+ metadata.gz: 2f1290755cf60610b63b7c82a4d043e662627a0c1b7a5692a70e987ddae69fa6
4
+ data.tar.gz: 05c9430233444a7915cb36789af8ebad99bc34391324c010a8e9c07f1cd36d33
5
5
  SHA512:
6
- metadata.gz: 21fc2ffb57f9ada23c1e90539a72d2cf6a593a18996ecbf76cf1143c22724433f49a4da8ee02f64b0939d9f4fc49db58993d6a48f74c6768754719c4c685495c
7
- data.tar.gz: 1b92a5280b4efa175e680c1ad927db865d2457251cc62aa1e9d4368fbcf42ce77e2699153f3b86f7cca5022d308b8f9f644c33bc8a846ccc2e7a8b0d5978584e
6
+ metadata.gz: ca2bf23c9b78a09dc984a974b86eadabddca8e4f90dbcdda263ff2295a61a4a6c1252fdeb5ad7ace732533887abef1d8636f5e1c6556f720485ed61d8e93da32
7
+ data.tar.gz: 508e707c528f5a729dea7de4a5940a6df8f70a3bd537295ef510a1280be322833b06bdc3b4242f869dae11c7cda09b07b84a9e13ead7f5810fb90f6f565e872c
@@ -0,0 +1,5 @@
1
+ {
2
+ "repo": [
3
+ "lutaml/lutaml-model"
4
+ ]
5
+ }
@@ -0,0 +1,20 @@
1
+ name: dependent-gems-test
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ tags: [ v* ]
7
+ paths-ignore:
8
+ - '**.adoc'
9
+ pull_request:
10
+ paths-ignore:
11
+ - '**.adoc'
12
+ workflow_dispatch:
13
+ repository_dispatch:
14
+ types: [ release-passed ]
15
+
16
+ jobs:
17
+ rake:
18
+ uses: metanorma/ci/.github/workflows/dependent-rake.yml@main
19
+ with:
20
+ command: bundle exec rspec
@@ -0,0 +1,59 @@
1
+ name: docs
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ repository_dispatch:
8
+ workflow_dispatch:
9
+
10
+ permissions:
11
+ contents: read
12
+ pages: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: ${{ github.workflow }}-${{ github.ref }}
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ build:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - name: Checkout
24
+ uses: actions/checkout@v4
25
+
26
+ - name: Setup Ruby
27
+ uses: ruby/setup-ruby@v1
28
+ with:
29
+ ruby-version: '3.3'
30
+ bundler-cache: true
31
+ cache-version: 0
32
+ working-directory: docs
33
+
34
+ - name: Setup Pages
35
+ id: pages
36
+ uses: actions/configure-pages@v5
37
+
38
+ - name: Build with Jekyll
39
+ run: bundle exec jekyll build --verbose --trace --baseurl "${{ steps.pages.outputs.base_path }}"
40
+ working-directory: docs
41
+ env:
42
+ JEKYLL_ENV: production
43
+
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v3
46
+ with:
47
+ path: docs/_site
48
+
49
+ deploy:
50
+ environment:
51
+ name: github-pages
52
+ url: ${{ steps.deployment.outputs.page_url }}
53
+ if: ${{ github.ref == 'refs/heads/main' }}
54
+ runs-on: ubuntu-latest
55
+ needs: build
56
+ steps:
57
+ - name: Deploy to GitHub Pages
58
+ id: deployment
59
+ uses: actions/deploy-pages@v4
@@ -1,10 +1,11 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: rake
4
2
 
3
+ permissions:
4
+ contents: write
5
+
5
6
  on:
6
7
  push:
7
- branches: [ master, main ]
8
+ branches: [ main ]
8
9
  tags: [ v* ]
9
10
  pull_request:
10
11
 
@@ -13,11 +14,10 @@ jobs:
13
14
  uses: metanorma/ci/.github/workflows/generic-rake.yml@main
14
15
  with:
15
16
  before-setup-ruby: |
16
- mkdir -p .bundle
17
- touch .bundle/config
18
- cat .bundle/config
19
- echo "---" >> .bundle/config
20
- echo 'BUNDLE_BUILD__RUBY___LL: "--with-cflags=-std=gnu17"' >> .bundle/config
21
- cat .bundle/config
17
+ vcpkg install libxml2:x64-windows 2>&1 || true
18
+ vcpkg integrate install 2>&1 || true
19
+ mkdir -p .bundle 2>&1 || true
20
+ echo "---" > .bundle/config 2>&1 || true
21
+ echo 'BUNDLE_BUILD__LIBXML___RUBY: "--with-xml2-dir=C:/vcpkg/installed/x64-windows --with-xml2-include=C:/vcpkg/installed/x64-windows/include/libxml2 --with-xml2-lib=C:/vcpkg/installed/x64-windows/lib"' >> .bundle/config 2>&1 || true
22
22
  secrets:
23
- pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
23
+ pat_token: ${{ secrets.GITHUB_TOKEN }}
@@ -1,7 +1,9 @@
1
- # Auto-generated by Cimas: Do not edit it manually!
2
- # See https://github.com/metanorma/cimas
3
1
  name: release
4
2
 
3
+ permissions:
4
+ contents: write
5
+ packages: write
6
+
5
7
  on:
6
8
  workflow_dispatch:
7
9
  inputs:
@@ -20,4 +22,4 @@ jobs:
20
22
  next_version: ${{ github.event.inputs.next_version }}
21
23
  secrets:
22
24
  rubygems-api-key: ${{ secrets.LUTAML_CI_RUBYGEMS_API_KEY }}
23
- pat_token: ${{ secrets.LUTAML_CI_PAT_TOKEN }}
25
+ pat_token: ${{ secrets.GITHUB_TOKEN }}
data/.gitignore CHANGED
@@ -11,3 +11,40 @@ Gemfile.lock
11
11
  # rspec failure tracking
12
12
  .rspec_status
13
13
  /spec/examples.txt
14
+
15
+ # Temporary test files
16
+ test_*.rb
17
+ test_*.txt
18
+ debug_*.rb
19
+
20
+ # Temporary status and documentation files
21
+ *_STATUS.md
22
+ *_KNOWN_ISSUES.md
23
+ libxml_*.txt
24
+ *_failures.txt
25
+ *_output.txt
26
+ *_results.txt
27
+
28
+ # Generated benchmark reports (machine-specific)
29
+ /benchmarks/PERFORMANCE_REPORT.md
30
+
31
+ # IDE and editor files
32
+ .vscode/
33
+ .idea/
34
+ *.swp
35
+ *.swo
36
+ *~
37
+ .DS_Store
38
+ /.kilocode
39
+ /*.md
40
+
41
+ .rubocop-https*
42
+
43
+ # Ruby version managers
44
+ .ruby-version.lock
45
+ .rvmrc
46
+
47
+ # Artifacts from static site generators
48
+ /_site
49
+ /docs/_site
50
+ /docs/.jekyll-cache
data/.rubocop.yml CHANGED
@@ -1,10 +1,18 @@
1
- inherit_from: .rubocop_todo.yml
1
+ inherit_from:
2
+ - https://raw.githubusercontent.com/riboseinc/oss-guides/main/ci/rubocop.yml
3
+ - .rubocop_todo.yml
4
+
5
+ plugins:
6
+ - rubocop-performance
7
+ - rubocop-rake
8
+ - rubocop-rspec
2
9
 
3
10
  AllCops:
4
11
  TargetRubyVersion: 3.0
5
-
6
- Style/StringLiterals:
7
- EnforcedStyle: double_quotes
8
-
9
- Style/StringLiteralsInInterpolation:
10
- EnforcedStyle: double_quotes
12
+ NewCops: enable
13
+ SuggestExtensions: false
14
+ Exclude:
15
+ - 'debug_*.rb'
16
+ - 'test_*.rb'
17
+ - 'vendor/**/*'
18
+ - 'tmp/**/*'
data/.rubocop_todo.yml CHANGED
@@ -1,101 +1,299 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2025-05-09 11:52:41 UTC using RuboCop version 1.68.0.
3
+ # on 2025-11-24 02:45:12 UTC using RuboCop version 1.80.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
7
7
  # versions of RuboCop, may require this file to be generated again.
8
8
 
9
- # Offense count: 1
10
- Lint/IneffectiveAccessModifier:
9
+ # Offense count: 179
10
+ # This cop supports safe autocorrection (--autocorrect).
11
+ # Configuration parameters: Max, AllowHeredoc, AllowURI, AllowQualifiedName, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
12
+ # URISchemes: http, https
13
+ Layout/LineLength:
14
+ Enabled: false
15
+
16
+ # Offense count: 6
17
+ # Configuration parameters: AllowedMethods.
18
+ # AllowedMethods: enums
19
+ Lint/ConstantDefinitionInBlock:
20
+ Exclude:
21
+ - 'spec/moxml/sax_spec.rb'
22
+
23
+ # Offense count: 6
24
+ # Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches, IgnoreDuplicateElseBranch.
25
+ Lint/DuplicateBranch:
11
26
  Exclude:
27
+ - 'benchmarks/generate_report.rb'
28
+ - 'lib/moxml/adapter/customized_libxml/declaration.rb'
29
+ - 'lib/moxml/adapter/libxml.rb'
30
+ - 'lib/moxml/document.rb'
31
+
32
+ # Offense count: 2
33
+ Lint/DuplicateMethods:
34
+ Exclude:
35
+ - 'lib/moxml/element.rb'
12
36
  - 'lib/moxml/node.rb'
13
37
 
14
38
  # Offense count: 1
15
- # Configuration parameters: MaximumRangeSize.
16
- Lint/MissingCopEnableDirective:
39
+ # Configuration parameters: AllowComments.
40
+ Lint/EmptyWhen:
17
41
  Exclude:
18
- - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
42
+ - 'lib/moxml/xpath/compiler.rb'
19
43
 
20
- # Offense count: 2
44
+ # Offense count: 1
45
+ Lint/IneffectiveAccessModifier:
46
+ Exclude:
47
+ - 'lib/moxml/node.rb'
48
+
49
+ # Offense count: 3
21
50
  # Configuration parameters: AllowedParentClasses.
22
51
  Lint/MissingSuper:
23
52
  Exclude:
24
53
  - 'lib/moxml/adapter/customized_oga/xml_declaration.rb'
25
54
  - 'lib/moxml/adapter/customized_rexml/formatter.rb'
55
+ - 'spec/moxml/xpath/ast/node_spec.rb'
26
56
 
27
- # Offense count: 8
28
- # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes.
57
+ # Offense count: 2
58
+ Lint/NoReturnInBeginEndBlocks:
59
+ Exclude:
60
+ - 'examples/api_client/api_client.rb'
61
+
62
+ # Offense count: 86
63
+ # Configuration parameters: AllowedMethods, AllowedPatterns, CountRepeatedAttributes, Max.
29
64
  Metrics/AbcSize:
30
- Max: 39
65
+ Enabled: false
31
66
 
32
- # Offense count: 53
33
- # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
67
+ # Offense count: 7
68
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns, inherit_mode.
34
69
  # AllowedMethods: refine
35
70
  Metrics/BlockLength:
36
- Max: 270
71
+ Max: 90
37
72
 
38
73
  # Offense count: 5
39
- # Configuration parameters: CountComments, CountAsOne.
40
- Metrics/ClassLength:
41
- Max: 373
74
+ # Configuration parameters: CountBlocks, CountModifierForms.
75
+ Metrics/BlockNesting:
76
+ Max: 4
42
77
 
43
- # Offense count: 7
44
- # Configuration parameters: AllowedMethods, AllowedPatterns.
78
+ # Offense count: 57
79
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
45
80
  Metrics/CyclomaticComplexity:
46
- Max: 15
81
+ Enabled: false
47
82
 
48
- # Offense count: 15
83
+ # Offense count: 157
49
84
  # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
50
85
  Metrics/MethodLength:
51
- Max: 23
86
+ Max: 110
52
87
 
53
88
  # Offense count: 3
54
- # Configuration parameters: AllowedMethods, AllowedPatterns.
89
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
90
+ Metrics/ParameterLists:
91
+ Max: 7
92
+
93
+ # Offense count: 36
94
+ # Configuration parameters: AllowedMethods, AllowedPatterns, Max.
55
95
  Metrics/PerceivedComplexity:
56
- Max: 16
96
+ Exclude:
97
+ - 'benchmarks/generate_report.rb'
98
+ - 'examples/web_scraper/web_scraper.rb'
99
+ - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
100
+ - 'lib/moxml/adapter/customized_rexml/formatter.rb'
101
+ - 'lib/moxml/adapter/libxml.rb'
102
+ - 'lib/moxml/adapter/ox.rb'
103
+ - 'lib/moxml/adapter/rexml.rb'
104
+ - 'lib/moxml/document.rb'
105
+ - 'lib/moxml/xpath/compiler.rb'
106
+ - 'lib/moxml/xpath/conversion.rb'
107
+ - 'lib/moxml/xpath/lexer.rb'
108
+ - 'lib/moxml/xpath/parser.rb'
109
+ - 'lib/moxml/xpath/ruby/generator.rb'
57
110
 
58
- # Offense count: 5
111
+ # Offense count: 15
59
112
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
60
113
  # AllowedNames: as, at, by, cc, db, id, if, in, io, ip, of, on, os, pp, to
61
114
  Naming/MethodParameterName:
62
115
  Exclude:
116
+ - 'benchmarks/generate_report.rb'
63
117
  - 'lib/moxml/adapter/customized_oga/xml_generator.rb'
118
+ - 'lib/moxml/adapter/libxml.rb'
64
119
  - 'lib/moxml/adapter/nokogiri.rb'
65
120
  - 'lib/moxml/adapter/ox.rb'
66
121
  - 'lib/moxml/adapter/rexml.rb'
67
122
  - 'lib/moxml/attribute.rb'
123
+ - 'lib/moxml/xpath/lexer.rb'
124
+
125
+ # Offense count: 1
126
+ # Configuration parameters: Mode, AllowedMethods, AllowedPatterns, AllowBangMethods, WaywardPredicates.
127
+ # AllowedMethods: call
128
+ # WaywardPredicates: nonzero?
129
+ Naming/PredicateMethod:
130
+ Exclude:
131
+ - 'lib/moxml/xpath/ruby/node.rb'
68
132
 
69
133
  # Offense count: 1
70
134
  # This cop supports unsafe autocorrection (--autocorrect-all).
71
- Style/CombinableLoops:
135
+ # Configuration parameters: OnlySumOrWithInitialValue.
136
+ Performance/Sum:
72
137
  Exclude:
73
- - 'lib/moxml/adapter/customized_rexml/formatter.rb'
138
+ - 'lib/moxml/xpath/compiler.rb'
74
139
 
75
- # Offense count: 28
76
- # Configuration parameters: AllowedConstants.
77
- Style/Documentation:
78
- Enabled: false
140
+ # Offense count: 42
141
+ # Configuration parameters: Prefixes, AllowedPatterns.
142
+ # Prefixes: when, with, without
143
+ RSpec/ContextWording:
144
+ Exclude:
145
+ - 'spec/integration/headed_ox_integration_spec.rb'
146
+ - 'spec/moxml/adapter/headed_ox_spec.rb'
147
+ - 'spec/moxml/adapter/shared_examples/adapter_contract.rb'
148
+ - 'spec/moxml/xpath/lexer_spec.rb'
149
+ - 'spec/moxml/xpath/parser_spec.rb'
150
+ - 'spec/performance/benchmark_spec.rb'
151
+
152
+ # Offense count: 14
153
+ # Configuration parameters: IgnoredMetadata.
154
+ RSpec/DescribeClass:
155
+ Exclude:
156
+ - '**/spec/features/**/*'
157
+ - '**/spec/requests/**/*'
158
+ - '**/spec/routing/**/*'
159
+ - '**/spec/system/**/*'
160
+ - '**/spec/views/**/*'
161
+ - 'spec/consistency/adapter_parity_spec.rb'
162
+ - 'spec/integration/all_adapters_spec.rb'
163
+ - 'spec/integration/headed_ox_integration_spec.rb'
164
+ - 'spec/moxml/error_spec.rb'
165
+ - 'spec/moxml/xpath/axes_spec.rb'
166
+ - 'spec/moxml/xpath/functions/boolean_functions_spec.rb'
167
+ - 'spec/moxml/xpath/functions/node_functions_spec.rb'
168
+ - 'spec/moxml/xpath/functions/numeric_functions_spec.rb'
169
+ - 'spec/moxml/xpath/functions/position_functions_spec.rb'
170
+ - 'spec/moxml/xpath/functions/special_functions_spec.rb'
171
+ - 'spec/moxml/xpath/functions/string_functions_spec.rb'
172
+ - 'spec/moxml/xpath/parser_integration_spec.rb'
173
+ - 'spec/moxml/xpath_capabilities_spec.rb'
174
+ - 'spec/performance/xpath_benchmark_spec.rb'
175
+
176
+ # Offense count: 215
177
+ # Configuration parameters: CountAsOne.
178
+ RSpec/ExampleLength:
179
+ Max: 85
180
+
181
+ # Offense count: 1
182
+ # This cop supports safe autocorrection (--autocorrect).
183
+ RSpec/ExpectActual:
184
+ Exclude:
185
+ - '**/spec/routing/**/*'
186
+ - 'spec/moxml/attribute_spec.rb'
187
+
188
+ # Offense count: 3
189
+ # Configuration parameters: Max, AllowedIdentifiers, AllowedPatterns.
190
+ RSpec/IndexedLet:
191
+ Exclude:
192
+ - 'spec/integration/shared_examples/node_wrappers/namespace_behavior.rb'
193
+
194
+ # Offense count: 102
195
+ # Configuration parameters: AssignmentOnly.
196
+ RSpec/InstanceVariable:
197
+ Exclude:
198
+ - 'spec/moxml/sax_spec.rb'
199
+
200
+ # Offense count: 6
201
+ RSpec/LeakyConstantDeclaration:
202
+ Exclude:
203
+ - 'spec/moxml/sax_spec.rb'
204
+
205
+ # Offense count: 2
206
+ # Configuration parameters: .
207
+ # SupportedStyles: have_received, receive
208
+ RSpec/MessageSpies:
209
+ EnforcedStyle: receive
210
+
211
+ # Offense count: 308
212
+ RSpec/MultipleExpectations:
213
+ Max: 10
214
+
215
+ # Offense count: 2
216
+ # Configuration parameters: AllowSubject.
217
+ RSpec/MultipleMemoizedHelpers:
218
+ Max: 7
219
+
220
+ # Offense count: 3
221
+ # Configuration parameters: AllowedPatterns.
222
+ # AllowedPatterns: ^expect_, ^assert_
223
+ RSpec/NoExpectationExample:
224
+ Exclude:
225
+ - 'spec/performance/xpath_benchmark_spec.rb'
226
+
227
+ # Offense count: 6
228
+ RSpec/PendingWithoutReason:
229
+ Exclude:
230
+ - 'spec/moxml/xpath/functions/position_functions_spec.rb'
231
+ - 'spec/moxml/xpath/functions/special_functions_spec.rb'
232
+
233
+ # Offense count: 2
234
+ RSpec/RepeatedExample:
235
+ Exclude:
236
+ - 'spec/integration/shared_examples/node_wrappers/node_set_behavior.rb'
237
+
238
+ # Offense count: 10
239
+ # Configuration parameters: CustomTransform, IgnoreMethods, IgnoreMetadata.
240
+ RSpec/SpecFilePathFormat:
241
+ Exclude:
242
+ - '**/spec/routing/**/*'
243
+ - 'spec/moxml/xpath/ast/node_spec.rb'
244
+ - 'spec/moxml/xpath/cache_spec.rb'
245
+ - 'spec/moxml/xpath/compiler_spec.rb'
246
+ - 'spec/moxml/xpath/context_spec.rb'
247
+ - 'spec/moxml/xpath/conversion_spec.rb'
248
+ - 'spec/moxml/xpath/lexer_spec.rb'
249
+ - 'spec/moxml/xpath/parser_spec.rb'
250
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
251
+ - 'spec/moxml/xpath/ruby/node_spec.rb'
252
+ - 'spec/moxml/xpath_spec.rb'
253
+
254
+ # Offense count: 1
255
+ # Configuration parameters: IgnoreNameless, IgnoreSymbolicNames.
256
+ RSpec/VerifiedDoubles:
257
+ Exclude:
258
+ - 'spec/moxml/xpath/conversion_spec.rb'
259
+
260
+ # Offense count: 1
261
+ Security/Eval:
262
+ Exclude:
263
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
79
264
 
80
265
  # Offense count: 1
81
266
  # This cop supports unsafe autocorrection (--autocorrect-all).
82
- # Configuration parameters: EnforcedStyle.
83
- # SupportedStyles: always, always_true, never
84
- Style/FrozenStringLiteralComment:
267
+ Style/CombinableLoops:
85
268
  Exclude:
86
269
  - 'lib/moxml/adapter/customized_rexml/formatter.rb'
87
270
 
271
+ # Offense count: 1
272
+ Style/DocumentDynamicEvalDefinition:
273
+ Exclude:
274
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
275
+
276
+ # Offense count: 1
277
+ # This cop supports safe autocorrection (--autocorrect).
278
+ Style/EvalWithLocation:
279
+ Exclude:
280
+ - 'spec/moxml/xpath/ruby/generator_spec.rb'
281
+
88
282
  # Offense count: 2
89
283
  # Configuration parameters: MinBranchesCount.
90
284
  Style/HashLikeCase:
91
285
  Exclude:
92
286
  - 'lib/moxml/adapter/customized_rexml/formatter.rb'
93
287
 
94
- # Offense count: 2
95
- # This cop supports unsafe autocorrection (--autocorrect-all).
96
- # Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength.
97
- # AllowedMethods: present?, blank?, presence, try, try!
98
- Style/SafeNavigation:
288
+ # Offense count: 1
289
+ Style/MissingRespondToMissing:
99
290
  Exclude:
100
- - 'lib/moxml/adapter/customized_rexml/formatter.rb'
101
- - 'lib/moxml/adapter/rexml.rb'
291
+ - 'lib/moxml/xpath/ruby/node.rb'
292
+
293
+ # Offense count: 4
294
+ # Configuration parameters: AllowedMethods.
295
+ # AllowedMethods: respond_to_missing?
296
+ Style/OptionalBooleanParameter:
297
+ Exclude:
298
+ - 'lib/moxml/adapter/libxml.rb'
299
+ - 'lib/moxml/xpath/compiler.rb'
data/Gemfile CHANGED
@@ -5,18 +5,23 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in moxml.gemspec
6
6
  gemspec
7
7
 
8
- gem "byebug"
9
- gem "get_process_mem", "~> 1.0"
10
- gem "nokogiri", "~> 1.15"
8
+ # Provides iteration per second benchmarking for Ruby
9
+ gem "benchmark-ips"
10
+ gem "get_process_mem"
11
+ gem "libxml-ruby", "~> 5.0"
12
+ gem "nokogiri", "~> 1.18"
11
13
  gem "oga", "~> 3.4"
14
+ gem "openssl"
12
15
  gem "ox", "~> 2.14"
13
- gem "rake", "~> 13"
16
+ gem "rake"
14
17
  gem "rexml"
15
- gem "rspec", "~> 3.0"
16
- gem "rubocop", "~> 1.21"
17
- gem "tempfile", "~> 0.3"
18
- # Provides iteration per second benchmarking for Ruby
19
- gem "benchmark-ips"
18
+ gem "rspec"
19
+ gem "rubocop"
20
+ gem "rubocop-performance"
21
+ gem "rubocop-rake"
22
+ gem "rubocop-rspec"
23
+ gem "simplecov", require: false
24
+ gem "tempfile"
20
25
 
21
26
  # Needed by get_process_mem on Windows
22
27
  gem "sys-proctable" if Gem.win_platform?
data/LICENSE.md CHANGED
@@ -5,10 +5,10 @@ This license file adheres to the formatting guidelines of
5
5
  [readable-licenses](https://github.com/nevir/readable-licenses).
6
6
 
7
7
 
8
- Ribose's BSD 2-Clause License
8
+ Ribose's BSD 3-Clause License
9
9
  -----------------------------
10
10
 
11
- Copyright (c) 2024, [Ribose Inc](https://www.ribose.com).
11
+ Copyright (c) 2025, [Ribose Inc](https://www.ribose.com).
12
12
  All rights reserved.
13
13
 
14
14
  Redistribution and use in source and binary forms, with or without modification,
@@ -21,6 +21,10 @@ are permitted provided that the following conditions are met:
21
21
  this list of conditions and the following disclaimer in the documentation
22
22
  and/or other materials provided with the distribution.
23
23
 
24
+ 3. Neither the name of the copyright holder nor the names of its contributors
25
+ may be used to endorse or promote products derived from this software
26
+ without specific prior written permission.
27
+
24
28
  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
25
29
  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26
30
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE