By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,605 Members | 1,629 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,605 IT Pros & Developers. It's quick & easy.

SAX model and XmlTextReader

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a


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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.