Esempio n. 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());
        }
Esempio n. 2
0
        /// <summary>
        /// Creates correspond xml
        /// </summary>
        /// <param name="doc">document to create element</param>
        /// <returns>The created element</returns>
        public XmlElement CreateXml(XmlDocument doc)
        {
            XmlElement   element  = doc.CreateElement("ArrowLabel");
            XmlAttribute attrName = doc.CreateAttribute("Name");

            attrName.Value = ComponentName;
            element.Attributes.Append(attrName);
            if (Arrow is IXmlElementCreator)
            {
                IXmlElementCreator c     = Arrow as IXmlElementCreator;
                XmlElement         child = c.CreateXml(doc);
                element.AppendChild(child);
            }
            return(element);
        }
Esempio n. 3
0
        /// <summary>
        /// Creates document from list of strings
        /// </summary>
        /// <param name="text">List of strings</param>
        /// <returns>The document</returns>
        public static XElement Create(IList <string> text)
        {
            XElement doc = XElement.Parse("<Root/>");

            int nr = text.Count - 1;
            int nc = text[nr].Length;

            --nc;
            int eRow;
            int eColumn;

            SimulinkXmlParser  parser  = new SimulinkXmlParser(doc);
            IXmlElementCreator creator = parser;

            StaticExtensionXmlParserLibrary.FindNext(text, '{', false, 0, 0, out eRow, out eColumn);
            XElement[] elements = parser.Create(text, eRow, eColumn, nr, nc);
            foreach (XElement e in elements)
            {
                doc.Add(e);
            }
            return(parser.doc);
        }
Esempio n. 4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 protected RecursiveXmlElementCreator()
 {
     This = this;
 }