decodeEntity method
Decodes a single character entity, returns the decoded entity or null
if
the input is invalid.
Implementation
@override
String? decodeEntity(String input) {
if (input.length > 1 && input[0] == '#') {
if (input.length > 2 && (input[1] == 'x' || input[1] == 'X')) {
// Hexadecimal character reference.
return _decodeNumericEntity(input.substring(2), 16);
} else {
// Decimal character reference.
return _decodeNumericEntity(input.substring(1), 10);
}
} else {
// Named character reference.
return entities[input];
}
}