Repository navigation
Resolve createElement() prefixes against the first match, not the root - #102
Merged
Merged
Conversation
QPXML::createElement() only resolves prefixes declared on the document element
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #102 +/- ##
============================================
+ Coverage 90.32% 90.38% +0.05%
Complexity 1430 1430
============================================
Files 25 25
Lines 3185 3181 -4
============================================
- Hits 2877 2875 -2
+ Misses 308 306 -2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
QPXML::createElement() looked an element name's prefix up on the owner document, which only sees declarations on the document element, so a prefix declared on the matched element or an ancestor below the root threw "Undefined namespace". Look it up on the element instead; root declarations are in scope there too. The foreach returned on its first pass, so only the first match was ever used. Use get(0) so the code says so. Fixes #94 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gravitypdf-bot
force-pushed
the
fix/issue-94
branch
from
October 25, 2026 23:37
834a3f2 to
b40b4c3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #94
QPXML::createElement()resolved a name's prefix withownerDocument->lookupNamespaceURI(), so only prefixes declared on the document element worked; one declared lower down threw "Undefined namespace for: y:item". It now resolves the prefix against the first matched element, where root-declared prefixes are in scope too.The
foreachthat returned on its first pass is replaced withget(0)and an early return for an empty match set. Callers see the same behaviour as before. The docblock now says the method works on the first match.Tests:
DOMQuery.The below-root and first-match tests fail on
main.🤖 Generated with Claude Code