Пример #1
0
        /// <summary>
        /// Parse only method. Parses and adds all entities found in the given node and adds them to the given
        /// list.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="entityElements"></param>
        public static void ParseFromXml(XmlNode rootNode)
        {
            if (rootNode != null)
            {
                RootElement rootElement = new RootElement();

//		ConfigElement.ParseFromXml(GetChildNodeByName(rootNode, "config"), rootElement.ConfigElements);
                ReportExtractionElement.ParseFromXml(GetChildNodeByName(rootNode, "reportextractions"), rootElement.ReportExtractions);
                EntityElement.ParseFromXml(GetChildNodeByName(rootNode, "entities"), rootElement.EntityElements);
                CollectionElement.ParseFromXml(GetChildNodeByName(rootNode, "collections"), rootElement.CollectionElements);
                EnumElement.ParseFromXml(GetChildNodeByName(rootNode, "enums"), rootElement.EnumElements);
                TypeElement.ParseFromXml(GetChildNodeByName(rootNode, "types"), rootElement.TypeElements);
                SqlTypeElement.ParseFromXml(GetChildNodeByName(rootNode, "sqltypes"), rootElement.SqlTypeElements);
                DatabaseElement.ParseFromXml(GetChildNodeByName(rootNode, "databases"), rootElement.DatabaseElements);
                GeneratorElement.ParseFromXml(GetChildNodeByName(rootNode, "generator"), rootElement.GeneratorElements);
            }
        }
Пример #2
0
        public static ArrayList ParseFromXml(Configuration options, XmlNode root, ParserValidationDelegate vd)
        {
            ArrayList   list  = new ArrayList();
            XmlNodeList nodes = root.SelectNodes("tasks/task");

            foreach (XmlNode node in nodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                TaskElement task = new TaskElement();
                task.Name           = node.Attributes["name"].Value;
                task.Element        = node.Attributes["element"].Value;
                task.Template       = node.Attributes["template"].Value;
                task.Directory      = node.Attributes["directory"].Value;
                task.FileNameFormat = node.Attributes["filenameformat"].Value;
                if (node.Attributes[BACKUP_DIRECTORY] != null)
                {
                    task.BackupDirectory = node.Attributes["backupdirectory"].Value;
                }
                else
                {
                    task.BackupDirectory = task.Directory;
                }
                if (!node.InnerText.Equals(String.Empty))
                {
                    task.Description = node.InnerText;
                }
                task.Includes   = IncludeElement.ParseFromXml(options, node, vd);
                task.Excludes   = ExcludeElement.ParseFromXml(options, node, vd);
                task.Parameters = ParameterElement.ParseFromXml(options, node, vd);
                task.Writer     = GetAttributeValue(node, WRITER, task.Writer);
                task.Styler     = GetAttributeValue(node, STYLER, task.Styler);
                TypeElement.ParseFromXml(node, task.Types);

                list.Add(task);
            }
            return(list);
        }