Everyone knows you can write regular expressions that are easy to understand as you write them but difficult to decipher later. XPATH of course suffers from the same problem. As an example I offer this:
.//Container[not(ancestor-or-self::Container/@name = 'buttonPanel' or ancestor::Container[contains(@name, TWTableWidget')])]|.//Component[not(ancestor::Container/@name = 'buttonPanel' or ancestor::Container[contains(@name, 'TWTableWidget')] or contains(@name, 'Zoom'))]|.//Component[@name = 'saveButton' and ancestor::Container[@name = 'buttonPanel']]
Thankfully when I wrote it I also wrote a comment.
Ignore the buttonPanel, anything it contains except for any saveButton, any Zoom buttons, and the contents of any TWTableWidget panels.
So there's obviously going to be no problems maintaining this in the future :)
Posted by Alex at November 07, 2002 01:20 PM