December 27th, 2001, 07:14 AM
Xhtml - <html xmlns=...> question.
I am updating my HTML to the xhtml 1.0 specification to make any updates later involving XML easier. At the moment my <html> tag looks like:
<html xml:lang="en" lang="en">
But I see that some people add the following:
Is it needed, and what does it do? I want to keep everything to specification and know what everything in the file does. Thanks for your help!
December 29th, 2001, 11:59 AM
It declares the main namespace. If you were to save your document as .xml instead of .html, and expected it to render as XHTML, you would need the xmlns="bla" declaration inside the root element.
December 30th, 2001, 05:52 PM
Slight clarification of what jkd explained: regardless of what extension you save the file with, to be an XHTML conforming document the xmlns attribute must be "present" with that value. Actually, the attribute is declared with a fixed value in the DTD, so if you don't specify it in your document it will still be valid. If you do specify it, it must have that value. See XHTML 1.0: The Extensible HyperText Markup Language: 3.1.1 Strictly Conforming Documents.