Now handles tag and attribute ids with uppercase letters.

Hopefully the issue / fix is self-explanatory. Sorry about the two lines with trimmed trailing whitespace...