I have been poking around on the Internet, and have not found any mention of something which should be an obvious idea. As a big fan of XML, I was thinking about one of its main disadvantages of imposing unnecessary extra bytes to markup the elements, and how it could be improved.
While shorthand already exists for closing an empty element, it seems to me that any closing tag in general pairs unambiguously with the presently-open element regardless of the opening tag name, therefore it should not matter to an XML parser whether the closing tag name actually matches, nor indeed whether any such name need be repeated at all. In practice it would be a good idea to require a match if a name is supplied since the continuity self-test can be useful and increase readability, but I would be all for allowing empty closing tags to work implicitly.
Existing long-form XML:
Proposed shorthand extension:
As best as I can determine, that structure should work. Since element names cannot be the empty string, the </> notation can only be to close the present open/top element, which should be a valid exercise in DRY.
- A bad idea - in which case, why?
- A good idea - in which case, should I propose it somehow, or just start implementing it in my own parsers for my own XML-based config files?