What you are looking for will not be an XML parser. XML is very strict regarding nesting, closure, etc. One of the other answers is Tag Soup . This is a good offer, although technically it is much closer to the lexer than to the parser. If all you want from the XML-ish content is an event stream without any validation, then it is almost trivial to roll your own solution. Just skip the entry by consuming content that matches regular expressions (this is exactly what Tag Soup does).
The problem is that the lexer will not be able to provide you with many functions that you want from the parser (for example, creating a tree view of input). You have to implement this logic yourself, because there is no way for such a "soft" parser to determine how to handle cases such as:
<parent> <child> </parent> </child>
Think: what tree would expect from this? There really is no reasonable answer to this question, and that is why the parser will not be very useful.
Now, not to say that you cannot use Tag Soup (or your own manual lexer) to create some kind of tree structure based on this input, but the implementation will be very fragile. With tree-oriented formats, such as XML, you really have no choice but to be strict, otherwise it becomes almost impossible to get a reasonable result (this is part of why the browser is so difficult to work with compatibility).
source share