Flangy > Software Development > C# / .NET > Reflective XML Parser
Keywords: XML Parser, Reflection, C#, .NET
This class is an XML Parser that uses reflection to act a bit like Python's sgmllib. You derive your parser from ReflectiveXmlParser and add methods with names like start_tagname and end_tagname that are called when those start and end tags are encountered.
C# being statically typed, this sort of call-by-name pattern might go against the grain of the language, but it's the first thing I thought of, and is easy to implement on top of an XmlReader. As an alternative, an informal survey shows that recursive decent parsing of XML is pretty popular.
I've started in on the "XML Documentation" for the class. I'll post that here, as soon as I figure out how to get the XML to turn into something, uh, useful.
Public domain.
Builds with Visual C# 2003.