473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Performance of XPathNavigator.Matches()

I'm experiencing bad performance with certain kinds of match queries. Using
a custom XPathNavigator that wraps the usual navigator I can see that many
more node visits are performed than should be required. My document looks
something like this:

<a>
<b>
<c/>
</b>
<b/>
<b/>
<!-- many more "b" elements here -->
</a>

I have a navigator positioned at the first "b" element. If I run the query
nav.Matches( "a/b[c]" ), only three nodes are visited in order to complete
the query. However, the query nav.Matches( "a/b[1]" ) visits *all* the
nodes in the document before it returns! I can understand perhaps why the b
nodes above the current position should be visitied to obtain the index of
the current element, but why visit anything after the current position?!
For example the query nav.Matches( "b[1]" ) visits only three nodes.

I believe I am once again getting stung by
System.Xml.XPath.MergeFilterQuery, which for some reason scans the entire
document for hits before returning the first one. Suprisingly it does this
in MatchNode() as well as advance()! Does anyone know MergeFilterQuery is
designed to do, and how it differs from FilterQuery? What is the reasoning
behind caching the list of hits?

Steve.
Nov 12 '05 #1
1 2642
We are finding that you can not assume any order of processing
when using the XSLT processor.

In the worst case scenario it performs a complete depth-first tree
walk and invokes Matches method to check if a node matches the
expression in the <xsl:template match="...">

When the expression there is an XPath it could be a lot more
efficient...
For our purposes it is not really usable on large custom
XPathNavigators.
"Steve Taylor" <NO**********@SPAMhotmail.com> wrote in message news:<eX**************@tk2msftngp13.phx.gbl>...
I'm experiencing bad performance with certain kinds of match queries. Using
a custom XPathNavigator that wraps the usual navigator I can see that many
more node visits are performed than should be required. My document looks
something like this:

<a>
<b>
<c/>
</b>
<b/>
<b/>
<!-- many more "b" elements here -->
</a>

I have a navigator positioned at the first "b" element. If I run the query
nav.Matches( "a/b[c]" ), only three nodes are visited in order to complete
the query. However, the query nav.Matches( "a/b[1]" ) visits *all* the
nodes in the document before it returns! I can understand perhaps why the b
nodes above the current position should be visitied to obtain the index of
the current element, but why visit anything after the current position?!
For example the query nav.Matches( "b[1]" ) visits only three nodes.

I believe I am once again getting stung by
System.Xml.XPath.MergeFilterQuery, which for some reason scans the entire
document for hits before returning the first one. Suprisingly it does this
in MatchNode() as well as advance()! Does anyone know MergeFilterQuery is
designed to do, and how it differs from FilterQuery? What is the reasoning
behind caching the list of hits?

Steve.

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Craig Pearson | last post by:
Hi My function receives an XPathNavigator object. From here I need to build a DataSet to load into SQL Server (using SQLXML adaptor). Does anyone have an idea on the most efficient way to...
0
by: bughunter | last post by:
This is more an observation than a request for assistance. I understand that the descendent-or-self axis (//) can be an inefficient way of writing a query if a more specific query is possible....
7
by: David Thielen | last post by:
Hi; Is there a way from an XPathNavigator object to get an xpath string that will, when used in a Select(xpath) on the underlying base/root XPathNavigator return the same XPathNavigator? In...
12
by: David Thielen | last post by:
Hi; I have an element: <space> </space> When I call SelectSingleNode() on it, the InnerXml is a 0 length String, not a String containing 1 space. Any ideas?
2
by: JSheble | last post by:
I'm integrating with a customer application, and in their assembly, when I call a method it returns data to us as an XPathNavigator object. I can parse the various elements I need out of this...
11
by: ericms | last post by:
Can anybody show me how to insert a CDATA section using XPathNavigator ? I have tried the follwing with no luck: XmlDocument docNav = new XmlDocument(); docNav.LoadXml(xmlString);...
2
by: Volkan | last post by:
Hi, I'm trying to compare two XML documents and i'm using XPath queries to select nodes. XPathNavigator's Select method runs fast enough and returns an XPathNodeIterator object. When i try to...
4
by: Bruce Sandeman | last post by:
Hi, Does anyone know how to serialize an XPathNavigator object? I have tried the following but it moans that the xpn does not have a parameterless constructor. XPathNavigator xpn =...
4
by: =?Utf-8?B?a2FydXpv?= | last post by:
Hi, I cannot guess, why some XPath expressions in my code returns false and some even errors, while the others returne true as I expected. I'am workin with VS 2008 Express Edition. Dim xEl As...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.