public static XmlDocument Apply(DataTemplate mainTemplate, DataTemplate freshTemplate, IXPathNavigable source)
        {
            if (freshTemplate == null)
            return mainTemplate.Apply(source);

              StringBuilder resultBuilder = new StringBuilder();
              using (XmlWriter writer = XmlWriter.Create(resultBuilder))
              {
            writer.WriteStartElement("Table");
            List<object> mainNodesList = new List<object>();
            foreach (IDataRow row in mainTemplate.GetRows(source))
              foreach (IDataColumn column in mainTemplate.Columns)
              {
            mainNodesList.Add(column.GetValue(row));
              }

            foreach (IDataRow row in freshTemplate.GetRows(source))
            {
              writer.WriteStartElement("Row");
              foreach (IDataColumn column in freshTemplate.Columns)
              {
            object value = column.GetValue(row);

            writer.WriteStartElement("Cell");
            if (value != null && !mainNodesList.Contains(value))
              writer.WriteAttributeString("new", "true");
            WriteCellValue(writer, value);
            writer.WriteEndElement();
              }
              writer.WriteEndElement();
            }
              }

              return XmlHlp2.XmlDocFromString(resultBuilder.ToString());
        }
 public object Clone()
 {
     DataTemplate result = new DataTemplate();
       result.Rules.AddRange(WebExtractorHlp.CopyList(this.Rules));
       result.Columns.AddRange(WebExtractorHlp.CopyList(this.Columns));
       return result;
 }
 public void SetUp()
 {
     template = new DataTemplate();
 }