I am currently working on a program that allows me to enter HTML source code into a RichTextBox control and removes the spaces from in between markups. The only problem is, I am not sure how I can differentiate between the spaces BETWEEN the markups and the spaces INSIDE the markups. Obviously, removing the spaces inside the markups would be bad. Any ideas as to how I can tell the difference?
Example: (before white space is removed)
<p>blahblahblah</p> <p>blahblahblah</p>
Example: (after white space is removed)
<p>blahblahblah</p><p>blahblahblah</p>
I'm using the following. Off the top of my head, it's shortcomings are not handling brackets inside HTML comments and inside CDATA. Are there any other angle brackets in HTML that don't signify tags?