473,396 Members | 1,786 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,396 software developers and data experts.

Which is better?

Hi,

This might be a stupid question, but which offers better performance
when processing xml? Is it the XmlDocument, XPathDocument, or just
using an XSLT file?

Thanks,
Roshawn
Nov 12 '05 #1
2 1301
"Roshawn Dawson" <ud****@bellsouth.net> wrote in message news:%2****************@tk2msftngp13.phx.gbl...
This might be a stupid question, but which offers better performance when processing xml?
What sort of processing are you trying to do?
Is it the XmlDocument,
XmlDocument is easiest and most flexible to do processing
where you want to modify something. It's not as fast as the
alternatives execution-wise, because it always involves the
reading of the entire XML file before you can do anything.

From a standpoint of how much of your time you'll spend,
though, it's often faster to write the code to use XmlDocument
then it is to write code for many of the alternatives. For small
files it may be the best choice; spend the development time
you save looking at other places in your application to improve
performance.
XPathDocument,
XPathDocument is a good solution if you are going to read
with XPath expressions. If you just want to read, there are
faster alternatives. It doesn't support modifications, so if
your processing involves modifying something, it's not even
applicable.
using an XSLT file?


If you know XSLT well, then XSLT is very flexible in the
sorts of manipulations you can make. It's good for data-
driven apps (change the XSLT instead of redeploying the
app). However, it always works through one of the other
solutions (commonly XPathDocument or XmlReader), so
it (arguably) can't be faster than they are. In theory, a
compiled XSLT stylesheet (.NET 2.0) could be optimized
to be as fast as a handcrafted XmlReader/Writer, but that
technology is probably several more years away.

You left out the fastest XML processing technique: Xml-
Readers. The simplest modifications may be as easy to
code as an XmlDocument, but complex manipulations
often involve greater investment in developing complex
XmlReaders (either consuming an XmlReader, or extend-
ing an XmlReader). Processing that only reads, and that
doesn't require XPath, can often be fastest when coded
as an XmlReader consumer.
Derek Harmon
Nov 12 '05 #2
Thank you for your input! That really helps!!

Roshawn

Derek Harmon wrote:
What sort of processing are you trying to do?

Is it the XmlDocument,

XmlDocument is easiest and most flexible to do processing
where you want to modify something. It's not as fast as the
alternatives execution-wise, because it always involves the
reading of the entire XML file before you can do anything.

From a standpoint of how much of your time you'll spend,
though, it's often faster to write the code to use XmlDocument
then it is to write code for many of the alternatives. For small
files it may be the best choice; spend the development time
you save looking at other places in your application to improve
performance.

XPathDocument,

XPathDocument is a good solution if you are going to read
with XPath expressions. If you just want to read, there are
faster alternatives. It doesn't support modifications, so if
your processing involves modifying something, it's not even
applicable.

using an XSLT file?

If you know XSLT well, then XSLT is very flexible in the
sorts of manipulations you can make. It's good for data-
driven apps (change the XSLT instead of redeploying the
app). However, it always works through one of the other
solutions (commonly XPathDocument or XmlReader), so
it (arguably) can't be faster than they are. In theory, a
compiled XSLT stylesheet (.NET 2.0) could be optimized
to be as fast as a handcrafted XmlReader/Writer, but that
technology is probably several more years away.

You left out the fastest XML processing technique: Xml-
Readers. The simplest modifications may be as easy to
code as an XmlDocument, but complex manipulations
often involve greater investment in developing complex
XmlReaders (either consuming an XmlReader, or extend-
ing an XmlReader). Processing that only reads, and that
doesn't require XPath, can often be fastest when coded
as an XmlReader consumer.
Derek Harmon

Nov 12 '05 #3

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

Similar topics

2
by: Amit D.Shinde | last post by:
Hello Experts.. I need some help regarding cookies and session objects and also global.asa file I am creating one cookie when a user logs in on my website. The cookie stores the login name of...
6
by: lastusernameleft | last post by:
i've been researching this issue for a while and can't come to any conclusive answer, mostly it seems to be a preference over syntax, some saying c# is elegant while vb is clunky, or that c# is...
1
by: Markus Rebbert | last post by:
Hi list, i got an postgresql installation on linux (debian) with the htree partitions: 1- system 2- postgresql data files 3- postgresql WAL logs(pg_xferlog) Our standard file system is...
4
by: Ed Davis | last post by:
I'm trying to decide which of the following programming styles is better, as in easier to understand, and thus easier to maintain. Keep in mind that for posting purposes, this is a greatly...
9
by: Robert Lario | last post by:
C# verses VB.Net Which Way to go. I am sure this issues has come up before. Please direct me to any good articles that cover this issue. Ideally some neutral assessment.
22
by: smartwolf agassi via DotNetMonster.com | last post by:
I'm a C# language learner. I want to know which IDE is better for C# programing, Borland C#Builder or VS.net 2003? -- Message posted via http://www.dotnetmonster.com
2
by: monkeydragon | last post by:
Which is better, using ReadFile/WriteFile or use fstream?
33
by: Protoman | last post by:
Which is better for general-purpose programming, C or C++? My friend says C++, but I'm not sure. Please enlighten me. Thanks!!!!!
48
by: meyer | last post by:
Hi everyone, which compiler will Python 2.5 on Windows (Intel) be built with? I notice that Python 2.4 apparently has been built with the VS2003 toolkit compiler, and I read a post from Scott...
20
by: mike3 | last post by:
Hi. (Xposted to both comp.lang.c++ and comp.programming since I've got questions related to both C++ language and general programming) I've got the following C++ code. The first routine runs in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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
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...
0
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...
0
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,...

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.