3 ms·
The mistake with the namespace syntax is that they wanted to allow plain textual copy-and-paste to work, thus the different ways and places in the document wher
by AlbertoGP 5y ago
The mistake with the namespace syntax is that they wanted to allow plain textual copy-and-paste to work, thus the different ways and places in the document where namespaces can be declared.
The big thing we missed was better tools from the get-go, specially xml-aware text editors.
That’s why the editors of the XML specification wanted to make things a bit easier for people doing things like writing XML with a plain text editor, or line-oriented processing using Perl. I think the amount of grief we are stuck with because of those time-limited needs is not worth it, thus the word “mistake” in the beginning of this post.
In hindsight, if anyone asked me how to add namespace support for XML, I would have required them all to be declared at the root of the document, in the XML declaration:
<?xml version="1.0" standalone="yes"
xmlns="https://docbook.org/ns/docbook"
xmlns:m="http://fake-w3.org/2001/Math/not-the-real-MathML"?>
<book>
...
<equation>
<title>MathML example</title>
<m:math mode="display">
<m:row>
<m:underover>
<m:o>∑</m:o>
<m:row>
<m:i>x</m:i>
<m:o>=</m:o>
<m:i>a</m:i>
</m:row>
<m:row>
<m:i>b</m:i>
</m:row>
</m:underover>
<m:sqrt>
<m:i>x</m:i>
</m:sqrt>
</m:row>
</m:math>
</equation>
</book>
Additionally, I would require them to be unique: only one prefix per namespace.
That would eliminate a lot of issues when writing XML processors, including editors.
I guess someone else mentioned this or a very similar idea at the time, and it was discarded to support plain text copy-and-paste by having the xmlns attribute in the element being copy-and-pasted. I don’t claim I would have done a better job, but I wish for a new version of XML that learns from these two and a half decades of use.