示例#1
0
        /// <summary>
        /// Creates Xml Element from strings
        /// </summary>
        /// <param name="text">The strings</param>
        /// <param name="bRow">The begin row</param>
        /// <param name="bColumn">The begin column</param>
        /// <param name="eRow">The end row</param>
        /// <param name="eColumn">The end column</param>
        /// <returns>Created Xml Element</returns>
        protected override XElement[] CreateElements(IList <string> text, int bRow, int bColumn, int eRow, int eColumn)
        {
            int bb = bRow;
            int bc = bColumn;
            int brf;
            int bcf;
            IXmlElementCreator creator = this;
            List <XElement>    l       = new List <XElement>();

            while (true)
            {
                try
                {
                    FindNext(text, bb, bc, out brf, out bcf);
                    XElement e = creator.Create(text, bb, bc, brf, bcf);
                    if (e == null)
                    {
                        break;
                    }
                    l.Add(e);
                    StaticExtensionXmlParserLibrary.FindNext(text, openString, true, brf, bcf, out bb, out bc);
                }
                catch (Exception ex)
                {
                    ex.ShowError(10);
                    break;
                }
            }
            return(l.ToArray());
        }
示例#2
0
        /// <summary>
        /// Creates Xml Element from strings
        /// </summary>
        /// <param name="text">The strings</param>
        /// <param name="bRow">The begin row</param>
        /// <param name="bColumn">The begin column</param>
        /// <param name="eRow">The end row</param>
        /// <param name="eColumn">The end column</param>
        /// <returns>Created Xml Element</returns>
        protected virtual XElement CreateInternal(IList <string> text, int bRow, int bColumn, int eRow, int eColumn)
        {
            List <int> l = null;

            if (dic.ContainsKey(bRow))
            {
                l = dic[bRow];
            }
            else
            {
                l         = new List <int>();
                dic[bRow] = l;
            }
            if (l.Contains(eRow))
            {
                return(null);
            }
            l.Add(eRow);
            int      bbRow    = bRow;
            int      bbColumn = bColumn;
            int      eeRow;
            int      eeColumn;
            XElement element = creator.Create(text, bRow, bColumn, eRow, eColumn);

            if (element == null)
            {
                return(null);
            }
            while (true)
            {
                char?c = StaticExtensionXmlParserLibrary.FindNext(text, openSymbol, false, bbRow, bbColumn, out eeRow, out eeColumn);
                if (c == null)
                {
                    return(element);
                }
                if (eeRow >= eRow)
                {
                    break;
                }
                if (eeRow == eRow)
                {
                    if (eeColumn >= eColumn)
                    {
                        break;
                    }
                }
                bbRow    = eeRow;
                bbColumn = eeColumn;
                StaticExtensionXmlParserLibrary.FindNextClose(text, openSymbol, closeSymbol, true, bbRow, bbColumn, out eeRow, out eeColumn);
                XElement e = This.Create(text, bbRow, bbColumn, eeRow, eeColumn);
                if (e != null)
                {
                    element.Add(e);
                }
                bbRow     = eeRow;
                bbColumn  = eeColumn;
                endRow    = eeRow;
                endColumn = eeColumn;
            }
            return(element);
        }