In C++ we can import msxml DLL to our application and then implement the methods of the interface ISAXContentHandler in a class of our application. Later create an ISAXReader object and invoke the contentHandler with the instance of this class where we have given the implemnatation for the eventhandler interfaces.
Similiarly I want to achieve the same thing in C#. Is there any way to do this in C#?? I mean is there any way to have eventbased SAX parsing in C#.
There is one more method I thought would help me in achieving parsing the XML documant and getting the XML information to my application.
I followed the link “http://www.codeguru.com/csharp/csharp/cs_data/xml/article.php/c4221“
Here DOM is used and System.XML namespace is being used.
Can anyone kindly help me with this regard,—-What is the way to achieve Event driven XML parsing in C#
or should I use System.XML namespace (DOM). if there exists a SAX event driven way plz let me know how to do it in C#
I think the closest you get to a SAX-reader in the .Net framework is the XmlReader class. It is not event based, but it allows you to iterate through the document in a similar manner. Look at this example: http://msdn.microsoft.com/en-us/library/system.xml.xmlreader.read.aspx
If you need maximum performance then the XmlReader is a good choice, but there are other alternatives that offer a more friendly api. The XmlDocument class allows you to treat the xml document as a hierarchical tree, while the XDocument allows you to use LINQ to parse the xml. Which one you need depends on which model you are comfortable with and your requirements.