Пример #1
0
        public static GeneratorElement ParseFromXml(Configuration options, XmlDocument doc, ParserValidationDelegate vd)
        {
            GeneratorElement generator = new GeneratorElement();
            XmlNodeList      elements  = doc.DocumentElement.GetElementsByTagName("generator");

            if (elements.Count == 0)
            {
                generator.Class = "Spring2.DataTierGenerator.Generator.CodeGenerator,Spring2.DataTierGenerator";
            }
            else
            {
                generator.Class = elements[0].Attributes["class"].Value;
                generator.Tasks = TaskElement.ParseFromXml(options, elements[0], vd);
                generator.Tools = ToolElement.ParseFromXml(options, elements[0], vd);
                foreach (XmlNode node in GetChildNodes(elements[0], WriterElement.WRITER))
                {
                    generator.Writers.Add(new WriterElement(node));
                }
                foreach (XmlNode node in GetChildNodes(elements[0], StylerElement.STYLER))
                {
                    generator.Stylers.Add(new StylerElement(node));
                }
            }
            return(generator);
        }
Пример #2
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="generatorElements"></param>
        public static void ParseFromXml(XmlNode node, IList generatorElements)
        {
            if (node != null && generatorElements != null)
            {
                foreach (XmlNode generatorNode in node.ChildNodes)
                {
                    if (generatorNode.NodeType.Equals(XmlNodeType.Element))
                    {
                        GeneratorElement generatorElement = new GeneratorElement();

                        generatorElement.Class = GetAttributeValue(generatorNode, CLASS, generatorElement.Class);
                        TaskElement.ParseFromXml(generatorNode, generatorElement.Tasks);
                        ToolElement.ParseFromXml(generatorNode, generatorElement.Tools);
                        foreach (XmlNode writer in GetChildNodes(generatorNode, WriterElement.WRITER))
                        {
                            generatorElement.Writers.Add(new WriterElement(writer));
                        }
                        foreach (XmlNode styler in GetChildNodes(generatorNode, StylerElement.STYLER))
                        {
                            generatorElement.Stylers.Add(new StylerElement(styler));
                        }

                        generatorElements.Add(generatorElement);
                    }
                }
            }
        }
Пример #3
0
        public static ArrayList ParseFromXml(Configuration options, XmlNode root, ParserValidationDelegate vd)
        {
            ArrayList   elements = new ArrayList();
            XmlNodeList nodes    = root.SelectNodes("tools/tool");

            foreach (XmlNode node in nodes)
            {
                if (node.NodeType == XmlNodeType.Comment)
                {
                    continue;
                }
                ToolElement element = new ToolElement();
                element.Name  = GetAttributeValue(node, NAME, element.Name);
                element.Class = GetAttributeValue(node, CLASS, element.Class);
                elements.Add(element);
            }
            return(elements);
        }
Пример #4
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="taskElements"></param>
 public static void ParseFromXml(XmlNode root, IList elements)
 {
     if (root != null && elements != null)
     {
         XmlNodeList nodes = root.SelectNodes("tools/tool");
         foreach (XmlNode node in nodes)
         {
             if (node.NodeType == XmlNodeType.Comment)
             {
                 continue;
             }
             ToolElement element = new ToolElement();
             element.Name  = GetAttributeValue(node, NAME, element.Name);
             element.Class = GetAttributeValue(node, CLASS, element.Class);
             elements.Add(element);
         }
     }
 }