While this has no impact, as far as I know, on processing the file, I’ve always wondered what the conventional approach is to the use of spaces before the closing bracket of an element tag. I’ve seen hundreds if not thousands of XML documents in my time and have yet to see a real pattern.
So I would like to know which of the two following notations would be preferred, if such a consensus exists.
<element attribute1="value1" attribute2="value2">
<element attribute1="value1" attribute2="value2" >
I realise that this may be a trivial question, but it would help me reach some consistency in my XML documents. I’ve noticed that the documents I’ve created through the years tend to switch between these two styles. Whenever I create a new document, I usually end up wasting a minute on deciding which style to use, so I welcome input on what style I should finally settle on.
Don’t format XML manually.
For example: http://www.xmltoolbox.com/
Actually, don’t format any source code manually. Computers are great at repetitive tasks, and can format XML with 100% consistency. Decide on a style you like and program the computer to do it.
That said, you rarely see
<element attribute="value" >in XML documents. Most browsers, as another example, will cinch up the closing angle bracket for XHTML source.