def consumeNumberEntity(self, isHex):
allowed = digits<EOL>radix = <NUM_LIT:10><EOL>if isHex:<EOL><INDENT>allowed = hexDigits<EOL>radix = <NUM_LIT:16><EOL><DEDENT>charStack = []<EOL>c = self.stream.char()<EOL>while c in allowed and c is not EOF:<EOL><INDENT>charStack.append(c)<EOL>c = self.stream.char()<EOL><DEDENT>charAsInt = int("<STR_LIT>".join(charStack), radix)<EOL>if charAsInt in replacementCharacters:<EOL><INDENT>char = replacementCharacters[charAsInt]<EOL>self.tokenQueue.append({"<STR_LIT:type>": tokenTypes["<STR_LIT>"], "<STR_LIT:data>":<EOL>"<STR_LIT>",<EOL>"<STR_LIT>": {"<STR_LIT>": charAsInt}})<EOL><DEDENT>elif ((<NUM_LIT> <= charAsInt <= <NUM_LIT>) or<EOL>(charAsInt > <NUM_LIT>)):<EOL><INDENT>char = "<STR_LIT>"<EOL>self.tokenQueue.append({"<STR_LIT:type>": tokenTypes["<STR_LIT>"], "<STR_LIT:data>":<EOL>"<STR_LIT>",<EOL>"<STR_LIT>": {"<STR_LIT>": charAsInt}})<EOL><DEDENT>else:<EOL><INDENT>if ((<NUM_LIT> <= charAsInt <= <NUM_LIT>) or<EOL>(<NUM_LIT> <= charAsInt <= <NUM_LIT>) or<EOL>(<NUM_LIT> <= charAsInt <= <NUM_LIT>) or<EOL>(<NUM_LIT> <= charAsInt <= <NUM_LIT>) or<EOL>charAsInt in frozenset([<NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>, <NUM_LIT>,<EOL><NUM_LIT>, <NUM_LIT>, <NUM_LIT>])):<EOL><INDENT>self.tokenQueue.append({"<STR_LIT:type>": tokenTypes["<STR_LIT>"],<EOL>"<STR_LIT:data>":<EOL>"<STR_LIT>",<EOL>"<STR_LIT>": {"<STR_LIT>": charAsInt}})<EOL><DEDENT>try:<EOL><INDENT>char = chr(charAsInt)<EOL><DEDENT>except ValueError:<EOL><INDENT>v = charAsInt - <NUM_LIT><EOL>char = chr(<NUM_LIT> | (v >> <NUM_LIT:10>)) + chr(<NUM_LIT> | (v & <NUM_LIT>))<EOL><DEDENT><DEDENT>if c != "<STR_LIT:;>":<EOL><INDENT>self.tokenQueue.append({"<STR_LIT:type>": tokenTypes["<STR_LIT>"], "<STR_LIT:data>":<EOL>"<STR_LIT>"})<EOL>self.stream.unget(c)<EOL><DEDENT>return char<EOL>
This function returns either U+FFFD or the character based on the
        decimal or hexadecimal representation. It also discards ";" if present.
        If not present self.tokenQueue.append({"type": tokenTypes["ParseError"]}) is invoked.