public static ArrayList ParseFromXml(Configuration options, XmlNode node, ParserValidationDelegate vd) { ArrayList elements = new ArrayList(); XmlNodeList includes = node.SelectNodes("includes/include"); foreach (XmlNode include in includes) { if (include.NodeType == XmlNodeType.Comment) { continue; } IncludeElement element = new IncludeElement(); element.Name = GetAttributeValue(include, NAME, element.Name); elements.Add(element); } return(elements); }
/// <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 node, IList elements) { if (node != null && elements != null) { XmlNodeList includes = node.SelectNodes("includes/include"); foreach (XmlNode include in includes) { if (include.NodeType == XmlNodeType.Comment) { continue; } IncludeElement element = new IncludeElement(); element.Name = GetAttributeValue(include, NAME, element.Name); elements.Add(element); } } }
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); }