Because XHTML is XML, you can validate it with the W3C validator or any XML parser — they flag unclosed tags, bad nesting, unquoted attributes, and DTD violations precisely. This was a selling point: deterministic error reporting. The downside in production was that real browsers in XML mode would refuse to render an invalid page at all.