472,986 Members | 2,933 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

SAX model and XmlTextReader

Does XmlTextReader class in .net represent SAX implementation?

If yes, are there any performance gains if I use C++ SAX implementation in
msxml4.dll versus XmlTextReader in .net? Did any one try this?

If no, what is the .net class that implements SAX model?

Thanks.
Raghu/..
Nov 12 '05 #1
3 3144


Raghu wrote:
Does XmlTextReader class in .net represent SAX implementation?
No, SAX is a push model while XmlTextReader is a pull model.
If yes, are there any performance gains if I use C++ SAX implementation in
msxml4.dll versus XmlTextReader in .net? Did any one try this?

If no, what is the .net class that implements SAX model?


There is no class in .NET SDK 1 or 1.1 that implements SAX however
searching with Google should find some third party implementations

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #2
So what are the implications of following code:

XmlTextReader tr = new XmlTextReader(sessionXml, XmlNodeType.Document,
null);

while (tr.Read())

{

if (tr.NodeType == XmlNodeType.Element && tr.LocalName == "myElement")

{

//TODO

}

}

Does the first line of code (creating XmlTextReader object with xml string)
parse the entire session xml? Does it parse only one xml node at a time when
Read method is called?

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:ug****************@TK2MSFTNGP12.phx.gbl...


Raghu wrote:
Does XmlTextReader class in .net represent SAX implementation?


No, SAX is a push model while XmlTextReader is a pull model.
If yes, are there any performance gains if I use C++ SAX implementation in msxml4.dll versus XmlTextReader in .net? Did any one try this?

If no, what is the .net class that implements SAX model?


There is no class in .NET SDK 1 or 1.1 that implements SAX however
searching with Google should find some third party implementations

--

Martin Honnen
http://JavaScript.FAQTs.com/

Nov 12 '05 #3
Parsing happens in chunks, through an internal buffer the internal
XmlScanner keeps. When you compare local names aganst strings, you should
use reference comparison by taking advantage of the built-in string
"atomization" that happens as the parsing occurs:

object el = tr.NameTable.Add( "myElement" );
while (tr.Read())
{
if (tr.NodeType == XmlNodeType.Element && tr.LocalName == el)

As "el" is declared as object, a fast reference comparison will be
performed.

--
Daniel Cazzulino [MVP XML]
Clarius Consulting SA
http://weblogs.asp.net/cazzu
http://aspnet2.com

"Raghu" <Ra***@nospamzzzqcsi.com> wrote in message
news:O1**************@TK2MSFTNGP11.phx.gbl...
So what are the implications of following code:

XmlTextReader tr = new XmlTextReader(sessionXml, XmlNodeType.Document,
null);

while (tr.Read())

{

if (tr.NodeType == XmlNodeType.Element && tr.LocalName == "myElement")

{

//TODO

}

}

Does the first line of code (creating XmlTextReader object with xml string) parse the entire session xml? Does it parse only one xml node at a time when Read method is called?

"Martin Honnen" <ma*******@yahoo.de> wrote in message
news:ug****************@TK2MSFTNGP12.phx.gbl...


Raghu wrote:
Does XmlTextReader class in .net represent SAX implementation?
No, SAX is a push model while XmlTextReader is a pull model.
If yes, are there any performance gains if I use C++ SAX
implementation in msxml4.dll versus XmlTextReader in .net? Did any one try this?

If no, what is the .net class that implements SAX model?


There is no class in .NET SDK 1 or 1.1 that implements SAX however
searching with Google should find some third party implementations

--

Martin Honnen
http://JavaScript.FAQTs.com/


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.679 / Virus Database: 441 - Release Date: 07/05/2004
Nov 12 '05 #4

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

Similar topics

1
by: Hang Cheng | last post by:
I've been trying to parse the following XML file with the .NET XMLTextReader: <?xml...
4
by: Andy Neilson | last post by:
I've run across a strange behaviour with XmlSerializer that I'm unable to explain. I came across this while trying to use XmlSerializer to deserialize from a the details of a SoapException. This...
5
by: Geoff Bennett | last post by:
While parsing an XML document, my TextReader instance skips nodes. For example, in this fragment: <Person Sex="Male" FirstHomeBuyer="No" YearsInCurrentProfession="14"> <RelatedEntityRef...
5
by: Chris | last post by:
Hi, the docs say : "The Xml-document is not loaded into memory when using XmlTextReader, as opposed to using the DOM where the entire document is loaded in memory" but, when using...
1
by: Damon Allison | last post by:
Hello, My program is being sent a large XML file, anywhere between 500k - 1MB. Of the entire file, I need to allow a user to view/edit approximately 5% of it. To make matters a bit more...
1
by: SHC | last post by:
Hi all, I did the "Build" on the attached code in my VC++ .NET 2003 - Windows XP Pro PC. On the c:\ screen, I got the following: Microsoft Development Environment An unhandled exception of type...
2
by: XML reading with XMLTextReader | last post by:
im trying to read an xml file which is in the wwwroot folder.im using IIS on XP Prof. my code is...
4
by: CodeRazor | last post by:
I am trying to use an XmlTextReader to retrieve data. I need to use an XmlTextReader because it is faster than using an XmlDocument. I have found an inelegant way of retrieving each item's title...
1
by: lejason | last post by:
Hi, I have an XML file that is a list of product models and info. The list will eventually contain about 100 products, each product having multiple elements for things like names,...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.