4 ms·
As far as I can tell, a SAX parser does not expose the distinction between an opening tag and a self-closing tag. The tag `<foo />` would just emit a startEleme
by goto11 5y ago
As far as I can tell, a SAX parser does not expose the distinction between an opening tag and a self-closing tag. The tag `<foo />` would just emit a startElement event followed by an endElement, exactly the same as `<foo></foo>`.
Which means it can't solve the specific problem the OP describes.
- crispyambulance 5y agoI would rather use a robust battle-tested parser and handle that edge case separately than to create regex for all of xhtml, copied off an opinionated blog, as a "hail-mary".
- goto11 5y agoBut the question is specifically about that edge case! So how to handle it, if the "robust battle-tested parser" is of no help?