public bool Compare(XmlReader source, XmlReader target, XmlDiffAdvancedOptions advOptions) { InitFiles(); this._SourceDoc.Load(source); this._TargetDoc.Load(target); XmlDiffNavigator nav = this._SourceDoc.CreateNavigator(); if (advOptions.IgnoreChildOrderExpr != null && advOptions.IgnoreChildOrderExpr != "") { this._SourceDoc.SortChildren(); this._TargetDoc.SortChildren(); } return(Diff()); }
public bool Compare(XmlReader source, XmlReader target, XmlDiffAdvancedOptions advOptions) { InitFiles(); _SourceDoc.Load(source); _TargetDoc.Load(target); XPathNavigator nav = _SourceDoc.CreateNavigator(); if (!string.IsNullOrEmpty(advOptions.IgnoreChildOrderExpr)) { XPathExpression expr = GenerateXPathExpression( advOptions.IgnoreChildOrderExpr, advOptions, nav); _SourceDoc.SortChildren(expr); _TargetDoc.SortChildren(expr); } if (advOptions.IgnoreNodesExpr != null && advOptions.IgnoreNodesExpr != "") { XPathExpression expr = GenerateXPathExpression( advOptions.IgnoreNodesExpr, advOptions, nav); _SourceDoc.IgnoreNodes(expr); _TargetDoc.IgnoreNodes(expr); } if (advOptions.IgnoreValuesExpr != null && advOptions.IgnoreValuesExpr != "") { XPathExpression expr = GenerateXPathExpression( advOptions.IgnoreValuesExpr, advOptions, nav); _SourceDoc.IgnoreValues(expr); _TargetDoc.IgnoreValues(expr); } return(Diff()); }
private static XPathExpression GenerateXPathExpression( string expression, XmlDiffAdvancedOptions advOptions, XPathNavigator nav) { XPathExpression expr = nav.Compile(expression); if (advOptions.HadAddedNamespace()) { XmlNamespaceManager xnm = new XmlNamespaceManager(nav.NameTable); foreach (KeyValuePair <string, string> each in advOptions.AddedNamespaces) { xnm.AddNamespace(each.Key, each.Value); } expr.SetContext(xnm); } return(expr); }
public bool Compare(XmlReader source, XmlReader target, XmlDiffAdvancedOptions advOptions) { InitFiles(); this._SourceDoc.Load(source); this._TargetDoc.Load(target); XmlDiffNavigator nav = this._SourceDoc.CreateNavigator(); if (advOptions.IgnoreChildOrderExpr != null && advOptions.IgnoreChildOrderExpr != "") { this._SourceDoc.SortChildren(); this._TargetDoc.SortChildren(); } return Diff(); }