/// <summary>
        /// Получение текста из xml
        /// </summary>
        /// <param name="xml">xml</param>
        /// <returns>текст</returns>
        private string GetText(string xml, IEnumerable <SimpleEntity> entities)
        {
            _shiftTable = new StairTableShift();
            _shift      = 0;
            var replace = new List <Tuple <TextPart, string> >();

            foreach (var match in _tagRegex.Matches(xml).Cast <Match>())
            {
                string result = " ";
                if ((match.Value == "</p>") || (match.Value == "</claim>"))
                {
                    result = "\n";
                }
                else if ((match.Value == "<sub>") || (match.Value == "</sub>") || (match.Value == "<sup>") || (match.Value == "</sup>"))
                {
                    result = "";
                }
                replace.Add(new Tuple <TextPart, string>(new TextPart(match.Index, match.Length), result));
            }
            foreach (var entity in entities)
            {
                if ((entity.Type == RegexEntityType.Diacritical) ||
                    (entity.Type == RegexEntityType.NumberWithDiacritical) ||
                    (entity.Type == RegexEntityType.SimpleDiacritical))
                {
                    int    start    = entity.Text.IndexOf("<sup>") + 5;
                    int    end      = entity.Text.IndexOf("</sup>");
                    string replaced = entity.Text.Substring(start, end - start).IndexOf(' ') >= 0 ? " " : "";
                    replace.Add(new Tuple <TextPart, string>(new TextPart(entity.StartPosition + start, end - start), replaced));
                }
            }
            AddSimpleReplace(replace, xml);
            replace = replace.OrderBy(_ => _.Item1.Start).ToList();
            StringBuilder text     = new StringBuilder();
            int           position = 0;
            int           shift    = 0;

            foreach (var replaced in replace)
            {
                shift += replaced.Item1.End - replaced.Item1.Start - replaced.Item2.Length;
                _shiftTable.UpdateShift(replaced.Item1.Start, shift);
                text.Append(xml.Substring(position, replaced.Item1.Start - position));
                text.Append(replaced.Item2);
                position = replaced.Item1.End;
            }
            text.Append(xml.Substring(position));
            return(text.ToString());
        }
 private void Initialization()
 {
     _builder    = new StringBuilder();
     _tableShift = new StairTableShift();
     _isSpace    = true;
 }