Ejemplo n.º 1
0
        /// <summary>
        /// Execute matches over the given seekable navigator. If the navigator is not safe, wrap it with one that is
        /// </summary>
        internal FilterResult Match(SeekableXPathNavigator navigator, ICollection <MessageFilter> matches)
        {
            // If the matcher places restrictions on the # of nodes we will inspect, and the navigator passed does
            // not do any nodecounting itself, we must make that navigator safe by wrapping it
            if (this.maxNodes < int.MaxValue)
            {
                navigator = this.CreateSafeNavigator(navigator);
            }

            QueryProcessor processor = this.CreateProcessor();

            processor.MatchSet = matches;
            processor.EnsureFilterCollection();
            try
            {
                processor.Eval(this.query, navigator);
            }
            catch (XPathNavigatorException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this.query));
            }
            catch (NavigatorInvalidBodyAccessException e)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(e.Process(this.query));
            }

            return(new FilterResult(processor));
        }
        internal FilterResult Match(Message message, bool matchBody, ICollection <MessageFilter> matches)
        {
            QueryProcessor processor = this.CreateProcessor();

            processor.MatchSet = matches;
            processor.EnsureFilterCollection();
            try
            {
                processor.Eval(this.query, message, matchBody);
            }
            catch (XPathNavigatorException exception)
            {
                throw TraceUtility.ThrowHelperError(exception.Process(this.query), message);
            }
            catch (NavigatorInvalidBodyAccessException exception2)
            {
                throw TraceUtility.ThrowHelperError(exception2.Process(this.query), message);
            }
            return(new FilterResult(processor));
        }
        internal FilterResult Match(SeekableXPathNavigator navigator, ICollection <MessageFilter> matches)
        {
            if (this.maxNodes < 0x7fffffff)
            {
                navigator = this.CreateSafeNavigator(navigator);
            }
            QueryProcessor processor = this.CreateProcessor();

            processor.MatchSet = matches;
            processor.EnsureFilterCollection();
            try
            {
                processor.Eval(this.query, navigator);
            }
            catch (XPathNavigatorException exception)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception.Process(this.query));
            }
            catch (NavigatorInvalidBodyAccessException exception2)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(exception2.Process(this.query));
            }
            return(new FilterResult(processor));
        }