Simplified xml-lexer and moved reference decoding to another function that happens after lexing. Attribute values now have references decoded as well.