Skip to content

Conversation

@labkey-tchad
Copy link
Member

Rationale

Wider use of tricky characters and string has revealed some defects in how we construct Locators.

We use XPath's normalize-space() method for most text matching but we don't normalize whitespace in the text we are comparing to. We need to perform normalization to both sides of comparisons we perform.

We have some Locators that do case-insensitive text matching. The current implementation only works for A-Z; an XPath translate statement that simulates a toLowerCase sort of operation (translate(normalize-space(), 'ABCDEFGHIJKLMNOPQRSTUVWXYZ', 'abcdefghijklmnopqrstuvwxyz')). We know the String the Locator will be comparing to, so we can construct a translate statement that does a toLowerCase for just the characters we care about matching, including ones with diacritics (e.g. Ä -> ä).

Related Pull Requests

Changes

  • Consistently normalize whitespace of strings
  • Support a wider set of characters for case-insensitive text matching

* "The normalize-space function strips leading and trailing white-space from a string, replaces sequences of
* whitespace characters by a single space, and returns the resulting string."
*/
private static String ns(String value)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest a better, more descriptive method name.

@labkey-tchad labkey-tchad merged commit ed1e0c2 into release25.3-SNAPSHOT Apr 14, 2025
5 checks passed
@labkey-tchad labkey-tchad deleted the 25.3_fb_trickyLocators branch April 14, 2025 16:57
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.

4 participants