I'm building a slicer for deserializing html and xml. The question is - is it legal in either language to put a space after angle bracket and still have it count as a tag? For example
< div>
Or should I just consider that plain text?
And yes, I tried searching web for this but even after browsing through w3, I couldn't spot an explicit answer.
An HTML space tag would be convenient for creating spaces, but the fact is that none exists.. The source of the problem is that HTML compresses all space characters—tabs, spaces, and carriage returns—to one character. If you want to indent your paragraphs, you can't simply type five spaces and then begin the text.
Usage of angle bracketsIn some languages, a double set of angle brackets may be used in place of quotation marks to contain quotes. In English, they may be used informally to insert asides, indicate speech in a foreign language, or to mention a website, but all of these uses are rare even in informal writing.
Left angle brackets are used to start tags; ampersands are used to denote HTML entities. If you want to use them as literal characters, you must escape them as entities, e.g. < , and & . in your anchor tag href attribute.
What Does Angle Bracket Mean? The angle bracket (< or >), which is also called an “inequality sign” for its use in mathematics, is a kind of sideways caret that can be used to include tags or pieces of code. This ASCII set of characters is common in web design and other types of coding projects.
The HTML spec from WHATWG indicates the opening bracket must be immediately followed by the tag name.
The XML spec from W3C has the same requirements.
You may not have space leading the tag name. However, there can be any amount of space between the end of the tag name and the closing bracket. The following is valid:
<p ></p >
<p
></p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With