I'm creating a language that translates to XML, and it doesn't support DOCTYPE/DTD. Can I use XHTML5 without having to specify <!DOCTYPE html>
, or am I stuck with having to implement DOCTYPE/DTD? I'd rather not, mainly to avoid language complexity.
The WHATWG says:
In the XML syntax, any doctype declaration may be used, or it may be omitted altogether.
The
<!DOCTYPE html>
definition is optional, but (...)
And the W3C says:
[The Document Type Declaration] may optionally be used within the XHTML syntax, but (...)
so we can safely assume that the DOCTYPE declaration is optional.
Also, a quick and dirty test shows that in the latest browsers, there is no discernible difference in handling files with or without a doctype declaration. As long as the file type is .xml
or .xhtml
.