Resources » Code Snippets » XML

SAX parser

Updated: Category: XML
Author: Member Level: GoldPoints: 12

A simple code for parsing your XML through SAX parser.

void ParseURL(string strUrl)
XmlTextReader reader = new XmlTextReader(strUrl);
while (reader.Read())
switch (reader.NodeType)
case XmlNodeType.Element:
Hashtable attributes = new Hashtable();
string strURI= reader.NamespaceURI;
string strName= reader.Name;
if (reader.HasAttributes)
for (int i = 0; i < reader.AttributeCount; i++)
//you can handle other cases here
//case XmlNodeType.EndElement:
// Todo
//case XmlNodeType.Text:
// Todo
catch (XmlException e)
Console.WriteLine("error occured: " + e.Message);

Did you like this resource? Share it with your friends and show your love!

Responses to "SAX parser"

No responses found. Be the first to respond...


Post Comment:

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)

    Type the numbers and letters shown on the left.

    Submit Article     Return to Article Index
    Subscribe to Subscribers
    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Talk to Webmaster Tony John

    Online Members

    Nirav Lalan
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India


    Click the "Follow" button above to follow Tony John