I know how white space is handled in text nodes for XML and HTML, but I'm uncertain about white spaces inside tag elements themselves. Obviously, white spaces are used inside tags to separate attributes, but is it valid to have white spaces after '<' or before '>'?
For example:
< foo >
< /foo >
Or even:
<foo>
< / foo >
Are these tags valid XML? What about HTML, assuming they were actual HTML tag names?
The specification (section 3.1 Start-tags, end-tags, and empty-element tags) says that there is no white space between the '<'
and the tag name, between '</'
and the tag name, or inside '/>'
. You can add white space after the tag name, though:
<foo >
</foo >
<bar
/>