Simple XML Parsing Library for ASP Nuke
by Kenneth Richards - Friday, January 28, 2005
from the Themes dept.
In preparation for adding theme support to ASP Nuke, I put together an ASP class that will parse an XML document and put it in a neatly organized class hierarchy. You can then query the document for a specific node or nodes and iterate over the results. This will be used to manage the configuration files for each ASP Nuke theme. The contents of which will be parsed and placed in the database for easy browsing.
The parser will handle multiple elements each with their own attributes. It can handle regular and self-closing elements and has no problems handling multiple elements with the same name. By using Microsoft's regular expression parser I was able to make the entire process very efficient. The XML configuration files are not very big so it wasn't too critical to make it efficient.
One thing I haven't solved yet is what to do with content between an open and closing element which is embedded with sub-elements. My parser will parse the sub-elements just fine, but I haven't worked out any way to handle content that is intermixed around the child elements. Maybe I will just wait until I absolutely need this functionality before I solve the problem.
Of course, I could have used Microsoft's SAX XMLReader object to do the parsing. But I am always trying to keep the requirements for my Nuke software to a minimum so it is easy-to-install as possible.
Watching football is like watching pornography. There's plenty of action, and I can't take my eyes off it, but when it's over, I wonder why the hell I spent an afternoon doing it.