示例#1
0
        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());
        }
示例#2
0
        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());
        }
示例#3
0
        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);
        }
示例#4
0
        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();
        }