4 ms·
The creators of XML were aware that it was verbose; they mention in their design goals that this was the least priority. Child and attribute "dichotomy" is not
by Mikhail_Edoshin 10y ago
The creators of XML were aware that it was verbose; they mention in their design goals that this was the least priority.
Child and attribute "dichotomy" is not a mistake. What you mean is that these two samples appear to be equivalent:
<foo value="123" />
<foo>123</foo>
But they are not equivalent. The first line (with an attribute) is there solely for the computer. When the document is rendered, the human user is not supposed to see anything there unless the computer adds it.
The second line (with text content) is there for both the computer and the human user. The text "123" is for the human user; the fact that this text is something called "foo" is for the computer. When the document is rendered, the human user will see "123" here. Maybe computer will enhance something or maybe it will just use it as index or reference, whatever.
Most people who don't like XML seem to only encounter it in config files. In config files there's normally no content that needs to be there for the end users, so all data can happily go into attributes. The text content starts to matter when we deal with natural language texts.
- wtbob 10y ago> The creators of XML were aware that it was verbose; they mention in their design goals that this was the least priority. Which seems pretty wasteful. > Child and attribute "dichotomy" is not a mistake. It's not for a markup format — as I mentioned, it can make sense there — but, as you mentioned, it doesn't make sense in a config or data file format.