public void DifferenceFound(Chorus.merge.xml.generic.xmldiff.XmlDiff inDiff, Difference difference) { _identical = false; if (difference.MajorDifference) { _equal = false; } _difference = difference; if (_stringBuilder.Length == 0) { _stringBuilder.Append(inDiff.OptionalDescription); } _stringBuilder.Append(Environment.NewLine).Append(difference); }
public static bool AreXmlElementsEqual(XmlInput ours, XmlInput theirs) { // Must use 'config', or whitespace only differences will make the elements different. // cf. diffing changeset 240 and 241 in the Tok Pisin project for such whitespace differences. var config = new DiffConfiguration(WhitespaceHandling.None); var diff = new XmlDiff(ours, theirs, config); var diffResult = diff.Compare(); return (diffResult == null || diffResult.Difference == null || !diffResult.Difference.MajorDifference); }
public XmlNode GetNodeToMerge(XmlNode nodeToMatch, XmlNode parentToSearchIn, HashSet<XmlNode> acceptableTargets) { if (parentToSearchIn == null) return null; //match any exact xml matches, including all the children. // (Could just search in acceptableTargets, but the previous version would return the FIRST match // in the parent, and that just MIGHT be important somehow.) foreach (XmlNode node in parentToSearchIn.ChildNodes) { if (nodeToMatch.Name != node.Name || !acceptableTargets.Contains(node)) { continue; // can't be equal if they don't even have the same name } if (node.GetType() == typeof(XmlText)) { throw new ApplicationException("Please report: regression in FindByEqualityOfTree where the node is simply a text."); } XmlDiff d = new XmlDiff(nodeToMatch.OuterXml, node.OuterXml); DiffResult result = d.Compare(); if (result == null || result.Equal) { return node; } } return null; }
private DiffResult PerformDiff(TextReader reader1, TextReader reader2) { _xmlDiff = new XmlDiff(reader1, reader2); DiffResult result = _xmlDiff.Compare(); return result; }