More tag refactoring; fix some bugs.
Add three tests for invalid attribute quote usage.