[Investigation] Verify xlink:href attribute access in Nokogiri - NOT NEEDED#11
[Investigation] Verify xlink:href attribute access in Nokogiri - NOT NEEDED#11Copilot wants to merge 2 commits intoindex_creatorsfrom
Conversation
Co-authored-by: alexdryden <47127862+alexdryden@users.noreply.github.com>
|
Can you check to make sure the issue identified here is still a problem in Nokogiri? |
|
@copilot Can you check to make sure the issue identified here is still a problem in Nokogiri? |
Tested with Nokogiri 1.19.0 (current version) - the bracket notation Testing with realistic EAC-CPF XML from the README shows both methods extract xlink:href values identically. The original code using bracket notation was actually correct and more readable. Should I revert this change back to the simpler Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Yes, please revert. Can you also evaluate the reasoning behind #9 with the same parameters to see if we really needed to make those adjustments? I suspect that case we did, but I'd like another set of eyes. |
|
@copilot I don't think we need to revert if it would be the same effect to just not merge this pr (please confirm this). Can you also evaluate the reasoning behind #9 with the same parameters to see if we really needed to make those adjustments? I suspect that case we did, but I'd like another set of eyes. |
Confirmed - not merging this PR has the same effect as reverting. The base branch will keep the simpler bracket notation. PR #9 evaluation: Those changes were absolutely necessary. Testing shows:
This is fundamental XPath behavior - when XML declares a default namespace ( The two PRs address different issues:
|
|
perfect! |
Investigation into whether Nokogiri requires special handling for namespaced XML attributes when accessing
xlink:hrefin EAC-CPF documents.Background
Original code review feedback suggested that
rel['xlink:href']is not reliably accessible in Nokogiri and should useattribute_with_ns('href', 'http://www.w3.org/1999/xlink')instead.Investigation Results
Testing with Nokogiri 1.19.0 (current version) shows:
rel['xlink:href']works correctlyCurrent Changes
Changed from bracket notation to
attribute_with_nsin bothrelated_agents_ssimandrelated_agent_uris_ssimfield mappings:Recommendation
This PR should NOT be merged. The original code using bracket notation was correct for modern Nokogiri. The change to
attribute_with_nsadds unnecessary complexity without providing any functional benefit. Simply not merging this PR will preserve the simpler, more readable bracket notation in the base branch.Related Investigation: PR #9 Validation
Also evaluated whether PR #9's namespace handling changes were necessary. Testing confirmed:
xpath('//control/recordId')fails to match elements when XML uses default namespace ✗xpath('//eac:control/eac:recordId', EAC_NS)correctly finds elements ✓The two PRs address different concepts:
Testing
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.