In case you aren't familiar with XML, XML is the eXtensible Markup Language. The entire reason for being for XML is to allow you to create a set of tags that will be recognized by a parser. Go to http://www.w3.org/XML/ for the definitive Web site on XML.
HTML is the HyperText Markup Language. xHTML is a version of HTML that conforms to the XML language requirements. HTML/xHTML are just a predefined set of tags. For more about the specifics of HTML/xHTML look here.
Now for some discussion directly relating to your question. XML is not a set of tags like HTML. XML allows you to define tags as needed by your application. The nicest thing about XML is that it allows you to do exactly what you're asking about.
You can define your own tags, or use HTML tags, and process them with a parser of your choice. A conforming XML parser already has the rules of XML built into it. There is no reason to write your own. I use the Oracle parser available at the Oracle Technology Web site.
There is also a free parser from Microsoft, MSXML.
You can also Google "XML PARSER" and get tons of hits.
I hope that answers your question. If you have any more, post away!
This was first published in November 2005