Skip to content

Parse XML attribute hashes without the removed deserializer - #280

Open
OskarEichler wants to merge 3 commits into
trailblazer:masterfrom
OskarEichler:codex/xml-attribute-hash-parsing
Open

Parse XML attribute hashes without the removed deserializer#280
OskarEichler wants to merge 3 commits into
trailblazer:masterfrom
OskarEichler:codex/xml-attribute-hash-parsing

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

AttributeHash inherits element lookup despite writing parent attributes. Read attribute nodes and replace the stale reference to nonexistent HashDeserializer.

Reproduction

require 'representable/xml'
require 'representable/xml/binding'
mod=Module.new { include Representable::XML; hash :values, use_attributes: true }
p Struct.new(:values).new.extend(mod).from_xml(%q{<item first='one'/>}).values
# nil before; {'first'=>'one'} after

Verification

  • Existing master suite on this isolated branch: 545 tests / 701 assertions, zero failures/errors, three existing skips on Ruby 3.2.11. Ruby 4.0.6 retains the same eight legacy inspection-format failures, zero errors and three skips. Existing tests/expectations are unchanged.
  • 50 focused checks on Ruby 3.2.11/4.0.6 for this change. XML first-render uses a separate fresh-process check.
  • Combined release-based verification with other focused fixes and attributed Use Setter in OverwriteOnNil if a :setter is defined #177/Hash value of null breaks parsing #264/Update MultiJSON usage to address deprecations #273 source backports: 544 tests / 700 assertions pass on Ruby 3.2.11, plus 4,410 focused checks and 36 boundary checks. Package retains 104 paths and unchanged compared metadata. All 36 runtime files compile on both Rubies; no newly introduced default Lint offenses.

Breaking changes / limitations

Attribute-hash properties now read their emitted data; no parent attributes yields an empty hash. Namespace-qualified attribute semantics are not expanded.

No new/modified checked-in tests. Ruby 2.4–3.1, JRuby, Windows and Linux were not executed locally. Ruby >=2.4 and runtime dependency ranges remain unchanged. External test tooling supplies a legacy MiniTest alias and ruby-prof 1.7.x; no assertions were changed. No production verification is claimed.

@seuros
seuros force-pushed the codex/xml-attribute-hash-parsing branch from 2ea87a1 to 8cb8ef2 Compare August 29, 2026 09:41

@seuros seuros left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why was HashDeserializer removed ?

Also a fix will need to have regression test attached.

Thanks for addressing this bug btw.

PS: i rebased this branch.

@OskarEichler

Copy link
Copy Markdown
Author

HashDeserializer no longer exists anywhere in the current XML implementation, so the remaining call could not succeed. The branch now reads the node attributes directly and includes a focused regression test for AttributeHash#read. The full xml_bindings_test.rb file passes: 5 tests, 5 assertions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants