I understand the differences between XML and HTML, but one particular aspect is not clear to me. XML is usually described as both a language that describes data, as well as a document markup language. Because of the former definition, XML is often compared to other data-describing formats such as JSON. Because of the latter definition, XML is also often compared to other document-markup languages, such as HTML.
I realize XML can function as both, but if XML is to serve as a document markup language, can document text appear between closing tags, in the same way it can with HTML?
Take the following HTML:
<div>
Some text, and some <b>more</b> text.
</div>
Ignoring the initial XML Declaration, is the above also valid XML? Note that the fragment text. is not enclosed in any tags: it appears between two closing tags. This is, of course, necessary in a markup language like HTML, where the goal is to format text. But most examples of XML I see use it to describe data, like:
<book>
<title>Blah blah</title>
<author>Blah blah</author>
</book>
In the above example, text never appears between closing tags.
So, is text (content) allowed to appear between closing tags in XML?
Yes. That is referred to as “mixed content”
You are correct in noting it as one of the requirements for a document
format as opposed to a data format. JSON is probably better as a data
format than XML, but because it does not allow mixed content, it cannot
replace XML as a document format.