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