473,494 Members | 2,266 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

XPath performance

Jon
I got a question on executing the xpath. Can someone let me know which way is
faster for the following two scenarios (one with XmlDocument and the other
using XmlDocument.CreateNavigator())?

XmlDocument doc = new XmlDocument();
doc.Load(input);

1. XmlNodeList nodes = doc.SelectNodes(xpathexp);
2. XmlNodeList nodes = doc.CreateNavigator().Select(xpathexp);
Jun 29 '06 #1
2 3425
The doc.SelectNodes is a convenience method that in turn calls
this.CreateNavigator().Select(xpath)
Note that XPathNavigator.Select returns an XPathNodeIterator and not an
XmlNodeList and hence the doc.SelectNodes internally creates an
XmlNodeList() that is returned.

Thanks,
Priya

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
I got a question on executing the xpath. Can someone let me know which way
is
faster for the following two scenarios (one with XmlDocument and the other
using XmlDocument.CreateNavigator())?

XmlDocument doc = new XmlDocument();
doc.Load(input);

1. XmlNodeList nodes = doc.SelectNodes(xpathexp);
2. XmlNodeList nodes = doc.CreateNavigator().Select(xpathexp);

Jun 29 '06 #2
Jon
So doc.CreateNavigator().Select(xpathexp) should be faster since it does not
need to build the NodeList. Is it true?

"Priya Lakshminarayanan" wrote:
The doc.SelectNodes is a convenience method that in turn calls
this.CreateNavigator().Select(xpath)
Note that XPathNavigator.Select returns an XPathNodeIterator and not an
XmlNodeList and hence the doc.SelectNodes internally creates an
XmlNodeList() that is returned.

Thanks,
Priya

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com...
I got a question on executing the xpath. Can someone let me know which way
is
faster for the following two scenarios (one with XmlDocument and the other
using XmlDocument.CreateNavigator())?

XmlDocument doc = new XmlDocument();
doc.Load(input);

1. XmlNodeList nodes = doc.SelectNodes(xpathexp);
2. XmlNodeList nodes = doc.CreateNavigator().Select(xpathexp);


Jun 30 '06 #3

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

Similar topics

1
6811
by: bdinmstig | last post by:
I refined my attempt a little further, and the following code does seem to work, however it has 2 major problems: 1. Very limited support for XPath features Basic paths are supported for...
2
1639
by: Jim | last post by:
Hi, When using an XPath query on an XML document that contains namespaces, is there a more efficient way to find a node set based on the local name than //* Is there another syntax that...
5
471
by: John Bailo | last post by:
I wrote a webservice to output a report file. The fields of the report are formatted based on information in an in-memory XmlDocument. As each row of a SqlDataReader are looped through, a...
1
1749
by: alpha | last post by:
Hi Friends, When we need the xpath namespace as we can traverse the xml document using xmldocument object like using selectSingleNode or selectNodes methods. In system.xml.xpath namespace we have to...
1
10915
by: Rob | last post by:
Hi, I am moving through an XML document using an XPath Navigator, and I'd like to be able to get the xpath expression for the location of the current node from the root node. Any ideas how to...
2
10038
by: dc | last post by:
i have a xml file like this: <?xml version="1.0" encoding="utf-8"?> <validate xmlns="http://tempuri.org/fieldValidate.xsd"> <field name="Short Name" type="SN" length="10"> <requiredChar...
5
2066
by: And80 | last post by:
Hi, I would like to use xpath modules in python2.4.... In my local machine I am running python2.3.5 and on the server I run python2.4. I have seen that while on my computer i am able to import...
1
2387
by: Sergey Dubinets | last post by:
In effort to prioritize our goals we composed the list of random features each of them may add value to set of XSLT tools offered from Microsoft. 1. XSLTc (Compiler for XSLT...
5
2285
by: Ben | last post by:
How does XPath performance compare to accessing a Hashtable structure? I will need to access the same data repeatedly throughout the lifecycle of my application. What factors should I take into...
2
2141
by: redcic | last post by:
Hi all, I would like to build a xml file using Xerces. I know how to build a single node at a time. For example, with 'doc' belonging to the DocumentImpl class and with 'docRootNode' belonging...
0
6989
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...
0
7157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7195
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7367
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
4579
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...
0
3088
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...
1
644
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
285
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...

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.