It is not possible for two main reasons:
1) HTML and XML are different:
When we talk about "HTML," we are referring to various standards, some of which (pre-4.01) do not follow the rules of XML. For example, in HTML 4.01, the <br>
tag is self-closing, but in XML it should be written as <br />
.
2) XML does not equal HTML:
While "XML" defines the syntax for valid documents or snippets, it lacks the semantics that HTML provides. This means that there are XML tags that are syntactically correct but have no meaning in HTML.
Just because a tag can be self-closed in XML doesn't mean it can in HTML. It's important to understand this distinction when making assumptions.
It is specified which tags can be self-closed in HTML, such as img
, but div
is not one of them.
EDIT: Let me clarify further.
Let's illustrate with logic:
X represents all XML rules
H represents all XHTML rules
if r is a rule in H, then r is also a rule in X:
r|H ===> r|X
if s is a rule in X, it may not be a rule in H:
s|X =/=> s|H
If s|x ===> s|H were true, then:
X === H
but we know X =/= H
I hope this explanation sheds light on your misunderstanding.