[erlang-patches] [PATCH] Fix XPath tokenising behaviour with attributes, commas

Anneli Cuss <>
Tue Nov 22 12:31:43 CET 2011

Hi all,

I have a one-line patch to xmerl_xpath_scan.erl which corrects
tokenising behaviour when attributes and commas get too friendly:

   git fetch git://github.com/anneli/otp.git fix_xmerl_xpath_scan

To view changes:


I have a question about testing; the xmerl code seems to have come
from its own world, and appears to be very much set up to test the
extent of W3C conformance. Hence, I'm not sure where a test belongs,
or indeed, where or how to implement it.

At any rate, here's how to reproduce the bug this fixes:

1> xmerl_xpath_scan:tokens("concat(' ', @a)").
** exception error: no function clause matching
(xmerl_xpath_scan.erl, line 151)
    in function  xmerl_xpath_scan:tokens/2 (xmerl_xpath_scan.erl, line 66)

This is a valid XPath snippet, but the tokeniser appears to confuse
part of the fragment for a boolean operator.


1> xmerl_xpath_scan:tokens("concat(' ', @a)").
 {literal,1," "},


Anneli Cuss

More information about the erlang-patches mailing list