System.Xml.DTDReader.GetCharacterReference C# (CSharp) Method

GetCharacterReference() private method

private GetCharacterReference ( DTDEntityBase li, string value, int &index, int end ) : int
li DTDEntityBase
value string
index int
end int
return int
		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;
		}