
Hi, everyone. I've been searching around for a simple XPath expression validator, just to check that the XPaths we hand-write are really valid. lxml looks like it might do well at this. However, I did find a case where an invalid expression doesn't throw: [ajvincent@localhost ~]$ python Python 2.7.8 (default, Nov 10 2014, 08:19:18) [GCC 4.9.2 20141101 (Red Hat 4.9.2-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information.
from lxml import etree etree.XPath("//b[contains(.)]") //b[contains(.)]
The contains function, as I understand it, takes exactly two arguments. http://www.w3.org/TR/xpath/#section-String-Functions I reproduced this with the python-lxml-3.3.6-1.fc21 package that Fedora 21 Linux provides, and on my MacBook with the py-lxml-3.4.1_0 MacPorts distribution. Please advise: is this a legitimate bug in lxml? If so, I'll file in the bug tracker. -- "The first step in confirming there is a bug in someone else's work is confirming there are no bugs in your own." -- Alexander J. Vincent, June 30, 2001