You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the find replace transform with an XPath that includes predicates it fails to locate the proper element because the referenced tag in the predicate is not namespaced.
This test in test_transforms.py passes because the test XML included is not namespaced however it fails if it were re-written as the following (note the added xmlns to bookstore):
The transformed xpath ends up looking like /*[local-name()="bookstore"]/*[local-name()="book"][price>40]/*[local-name()="author"][2]
note how price here does not reference local-name.
I think something that could work here is instead of parsing the xpath to add local-name references, storing predicates and re-adding them, the process can be simplified significantly (and made a bit more robust) by simply removing the xmlns declaration and then adding it back at the end.
Refactor find_replace logic to support XML namespaces properly. The update substitutes temporary replacement of 'xmlns' attribute with 'xmlnamespace', facilitating namespace-agnostic XPath expressions. Tests added to validate the improved functionality.
ResolvesSFDO-Tooling#3771.
Describe the bug
When using the find replace transform with an XPath that includes predicates it fails to locate the proper element because the referenced tag in the predicate is not namespaced.
This test in test_transforms.py passes because the test XML included is not namespaced however it fails if it were re-written as the following (note the added xmlns to bookstore):
The transformed xpath ends up looking like
/*[local-name()="bookstore"]/*[local-name()="book"][price>40]/*[local-name()="author"][2]
note how price here does not reference local-name.
I think something that could work here is instead of parsing the xpath to add local-name references, storing predicates and re-adding them, the process can be simplified significantly (and made a bit more robust) by simply removing the xmlns declaration and then adding it back at the end.
Reproduction steps
Your CumulusCI and Python versions
CumulusCI version: 3.85.0
Python version: 3.11.7
Operating System
Mac OSX 14.4
Windows environment
No response
CumulusCI installation method
None
Error Gist
No response
Additional information
No response
The text was updated successfully, but these errors were encountered: