Example #1
0
        private XElement DoChangeElement(XElement target, bool throwOnError, XDiffOptions options)
        {
            var e = Find(target, BasisElement, options);

            if (null == e)
            {
                if (throwOnError)
                {
                    throw new Exception("cannot find target for " + BasisElement);
                }
                return(target);
            }
            if (NewValue.Contains("<") && NewValue.Contains(">"))
            {
                e.Nodes().ToArray().Remove();
                var x = XElement.Parse("<a>" + NewValue + "</a>");
                foreach (var n in x.Nodes())
                {
                    e.Add(n);
                }
            }
            else
            {
                e.Value = NewValue;
            }
            return(target);
        }
Example #2
0
 private void ResolveRemovedObjects()
 {
     RemovedObjects.Clear();
     foreach (var removedMember in OldValue.Where(pm => !NewValue.Contains(pm)))
     {
         RemovedObjects.Add(removedMember);
     }
 }