Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAX for C#?

 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know of an open source effort to produce a SAX/DOM processor in C#?
Here's something amusing... As part of .NET, Microsoft supplies an XmlTextReader class that works as a pull processor. It should work perfectly for any size XML file since all it does is read the file and pass the next node you request. It is a forward-only read-only processor. For some reason, the genius who wrote the code decided to process everything as an offset from the beginning of the file. And furthermore, this genius decided to store that offset as an int. This means that if your XML file is larger that Int32.MaxInt the program craps out! MS acknowledges the error but it won't be fixed anytime soon.
Be amused by the code here:
http://dotnet.di.unipi.it/Content/sscli/docs/doxygen/fx/bcl/xmltextreader_8cs-source.html
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But let’s just look at the numbers -
2^32 bytes =
2^24 KBs =
2^16 MBs =
2^8 GBs =
2^0=1 TB
So, one terabyte of XML seems to me quite sufficient for most purposes.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's actually 2^31 - 1
2,147,483,647
That a little over 2 gig. We have a 6 gig XML file that we are trying to process and we can't unless we either split the file or write our own XML processor. Thus my question about a SAX processor for C#.
 
Dan Drillich
Ranch Hand
Posts: 1183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You are right!
Let me try again -
2^32 bytes =
2^22 KBs =
2^12 MBs =
2^2=4 GBs
Positive/Negative for int. So exactly 2GB.
Cheers,
Dan
[ October 11, 2002: Message edited by: Dan Drillich ]
 
Guennadiy VANIN
Ranch Hand
Posts: 898
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The Microsoft SAX2 implementation provides both Microsoft� Visual Basic� and Microsoft Visual C++� interfaces.
It is difficult to imagine because all Web developers for MS platform were using VBScript and will continue, in the nearest future.
Even I, as SPJP2, have difficulty because Visual Studio.NET have all examples/samples (in MSDN and Helps) on WEB/XML development only for jscript, VBScript, VC++, VB, that are not even compatible with .NET platform.
Please correct me, where I am wrong
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic