DOCTYPE and xmlns

Discussing Html . Code , Software , other

Moderators: macek, egami, gesf

New php-forum User
New php-forum User
Posts: 1
Joined: Fri Dec 30, 2011 11:04 am

DOCTYPE and xmlns

Postby BB4033 » Fri Dec 30, 2011 11:24 am


at last I too have decided to conquer the knowledge of making a web page. Well truth be told, I have written a page or two already but they were so simple that very few knowledge was necessary to get the job done. Now I am taking a bit more professional approach and that is also why I joined this forum.

I already stumbled on my first problem in the first two lines of most web pages' source page. :) For starters, I would like to make it clear to myself, what are DOCTYPE and xmlns. After googling for some time I am having trouble finding the differences between them.

If I interpreted what I read correctly, then the DOCTYPE declaration is the place where the "grammar" for the rest of the document is defined. So, which element is the root, which can be nested under others and which not, the attributes of each element, which of these attributes are required, etc.

While I was able to find an example for a .dtd file in which this "grammar" is gathered in one place, I could not find a similar example for the namespace, so that I could figure out from there what it is. So my first question would be: is a certain namespace contained in a file somewhere or not? Since the namespace URI is a URL which does not point to any file, the file must already be on the computer. If there even is a file, that is. Or, since the URI is just a sort of an identification string, is all the information about a certain namespace already somehow "inside" the browser?
How does one go about creating his/her own namespace?

As far as I could gather by googling, namespaces are used to distinguish between html elements and attributes which have the same name. All clear. But doesnt the .dtd file (the DOCTYPE declaration) already take care of that?

I hope I explained my dilemma clearly enough. I would like to thank everyone in advance for all the answers and help.


Return to “HTML Basics”

Who is online

Users browsing this forum: No registered users and 1 guest