Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> > All white space in HTML and XML is preserved verbatim.

> Do you mean "any change to whitespace in HTML or XML results in a semantically inequivalent document"? That's a perspective you can take, but it has pretty undesirable results: it means you can't ever reformat HTML or XML source. And it very clearly contradicts how most people understand and expect to work with HTML.

I don't think that's what grandparent meant. I read that HTML and XML do not impose any coalescing of whitespace. Whatever whitespace is read by a parser is accepted as such. Whether the whitespace has semantic value or not is not a concern for HTML or XML as data formats.

On the other hand, coalescing whitespace is a feature of HTML and XML renderers.

And you are correct: a tool that reformats whitespace inside a <verbatim> tag will output semantically wrong results (e.g. if the contents are Python code). Which supports the point: the semantics of whitespace are not determined by the HTML or XML data formats, but by the tools generating and consuming the data.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: