473,802 Members | 1,978 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

XPathNavigator, Attribute predicate evaluation


I have implemented in .NET 2.0 a custom XPathNavigator for Xpath filtering
on an object tree. So far it works. While analyzing the performance, I have
noticed a lot of MoveToNextAttri bute calls.

A closer look has shown that there seems to be a none optimal evaluation of
attribute predicates such as [@ID = '2']. It works as expected if there is a
match of the attribute value, i.e. the XPathNavigator calls
MoveToNextAttri bute until it gets the ID attribute, reads the value and
finish the search.

The behaviour is different if the value if the ID attribute does not match
the value in the predicate. Then the XPathNavigator calls
MoveToNextAttri bute until it returns false, i.e. until all attributes are
checked. From my point of view, the search for attributes could be stopped
if there is a match of the attribute name as the attribute names for a node
must be unique.

Stop the search if the attrbute name matches would improve the performance
by factors. In my data model, there are about 20 attributes. Most the
filters are using the ID attribute. By placing the ID attribute at the first
position in the collection, the potential performance gain is a factor of
20.


Mar 3 '06 #1
1 1838

I'm nobody of authority, but I'd say you have an excellent point there!

Since you've implemented a navigator in 2.0, do you find that there is
anything that would need to be done differently than one in 1.1? I have done
a couple in 1.1, and since I'm just getting familiar with 2.0 proper I really
don't know all of the ways in which I could improve my performance with it..
I have read that the xmlnametable implementation is better, but that's all I
have so far...

Any tips?

"SteZgr" wrote:

I have implemented in .NET 2.0 a custom XPathNavigator for Xpath filtering
on an object tree. So far it works. While analyzing the performance, I have
noticed a lot of MoveToNextAttri bute calls.

A closer look has shown that there seems to be a none optimal evaluation of
attribute predicates such as [@ID = '2']. It works as expected if there is a
match of the attribute value, i.e. the XPathNavigator calls
MoveToNextAttri bute until it gets the ID attribute, reads the value and
finish the search.

The behaviour is different if the value if the ID attribute does not match
the value in the predicate. Then the XPathNavigator calls
MoveToNextAttri bute until it returns false, i.e. until all attributes are
checked. From my point of view, the search for attributes could be stopped
if there is a match of the attribute name as the attribute names for a node
must be unique.

Stop the search if the attrbute name matches would improve the performance
by factors. In my data model, there are about 20 attributes. Most the
filters are using the ID attribute. By placing the ID attribute at the first
position in the collection, the potential performance gain is a factor of
20.


Apr 14 '06 #2

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

Similar topics

2
1517
by: Jacques | last post by:
Is it possible to predicate by attribute, and if so, how? <System xmlns="" name="SAP_R3_Financials_DEV200"> <Attributes xmlns=""> <pcd:Attribute name="ApplicationServer" value="secacsap"/> <pcd:Attribute name="ServerPort" value="3200"/> </Attributes> </System> --------------------------------------------- I want to be able to
7
3900
by: news.microsoft.com | last post by:
Hi, Is the compilation of XSLT, using XPathNavigator.Compile, only beneficial when the returned XPathExpression is cached? Next question, how do I cache the returned XPathExpression object? Should I programmatically cache it or is it automatically cached when the Compile method is called? Thanks
0
1167
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. However, there is one particular type of expression using '//' that XPathNavigator executes far slower than I would expect, these are queries of the form: /a//b If I drop the predicate then the query executes quickly, as does //b all by itself....
4
2279
by: Karine Bosch | last post by:
Hi, My xml document uses different namespaces: <x:root xmlns:x="x:ns:meta/"> <element1 xmlns:adam="http://ns.alfaprint.be/"> </root> This gives problems when using an XPath query. I already created 2 namespace managers
1
6355
by: Keith Patrick | last post by:
I'm converting over from using XmlNodes (specifically ConfigXmlNode, but the API uses XmlNode) to IXPathNavigable in some methods I have, but I'm finding in the process, that I can't seem to get the attributes. If I have some XML: <ApplicationConfiguration Test="Blahblah" AnotherAttr="asdfasd">
0
1796
by: kelvin273 | last post by:
Hi all, i'm new in this community (and in .NET programming) and i've a problem with xpathnavigator. The idea is to have an xml document with attribute editable by windows form. I write this code, where xPath is, of course, the correct path of the selected node, and NodeEntity is a class that encapsulate the new attribute value. The method extract value from NodeEntity and update attribute value of the current node. But i don't find the...
2
4543
by: =?Utf-8?B?Tm9yZW1hYw==?= | last post by:
Hi. Using VS2005, .NET 2.0. I have an xml document that I want to go through and set the values on attributes of elements. The elements are complex types defined in my schema (xsd) files. I can iterate the document and get my XmlType and XmlBaseType values just fine. However, as soon as I call SetValue to write to an attribute, the
3
1932
by: Arun Srinivasan | last post by:
I have a query that has 5 predicates, scanning a table of 400+ million rows and I have built indexes getting help from design advisor and other tools. The cost of that query is really low. But I federated the server and created a nickname for that table, and when I give the same query against the nickname, it tries to fetch the whole table (cost 1.7 billion), and do the predicate evaluation in my smaller test box. I did build indices in my...
2
436
by: =?Utf-8?B?QXJuZQ==?= | last post by:
I use XpathNavigator ut process the XML data I get from a web service. I know how to select a specific node. How Do I pick of the attribute of a node?
0
9562
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10285
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9115
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6838
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5494
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5622
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4270
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3792
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2966
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.