restructured parsing to catch invalid attribute names
Merge pull request #319 from Pomax/bug943432

restructured parsing to catch invalid attribute names