private int GetCharacterReference (DTDEntityBase li, string value, ref int index, int end)
{
int ret = 0;
if (value [index] == 'x') {
try {
ret = int.Parse (value.Substring (index + 1, end - index - 1), NumberStyles.HexNumber, CultureInfo.InvariantCulture);
} catch (FormatException) {
throw new XmlException (li, li.BaseURI, "Invalid number for a character reference.");
}
} else {
try {
ret = int.Parse (value.Substring (index, end - index), CultureInfo.InvariantCulture);
} catch (FormatException) {
throw new XmlException (li, li.BaseURI, "Invalid number for a character reference.");
}
}
index = end;
return ret;
}