SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Addict CWebguy's Avatar
    Join Date
    Mar 2009
    Posts
    247
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    xmlns="" What is the point of it?

    I could see if it were like a doctype which changes the way a page is rendered, but what is the point of

    xmlns="http://www.w3.org/1999/xhtml"?

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,048
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    Namespaces are important for identifying which "group" a tag belongs to. Perhaps they're not so important in a lot of cases. But if the XML file has identical tag names used in different contexts they're a must use.

  3. #3
    Programming Since 1978 silver trophybronze trophy felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, NSW, Australia
    Posts
    16,789
    Mentioned
    25 Post(s)
    Tagged
    1 Thread(s)
    As an example. If you combine XHTML with a second markup language designed to define information about books then both languages would have a <title> tag. You would then need to define which namespace each title tag was in so that the program processing the code would know whether it was a web page title or a book title that a given title tag was referring to.
    Stephen J Chapman

    javascriptexample.net, Book Reviews, follow me on Twitter
    HTML Help, CSS Help, JavaScript Help, PHP/mySQL Help, blog
    <input name="html5" type="text" required pattern="^$">

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by CWebguy View Post
    I could see if it were like a doctype which changes the way a page is rendered, but what is the point of

    xmlns="http://www.w3.org/1999/xhtml"?
    The point of the XML namespace declaration is that it tells user agents that the document contains XHTML, rather than any other application of XML.

    There are two things that are required to make a document be recognised as XHTML:
    1. The Content-Type HTTP header must declare a MIME type that specifies an application of XML.
    2. The xmlns attribute must contain the value "http://www.w3.org/1999/xhtml".

    The recommended MIME type for XHTML is application/xhtml+xml, but it's also possible to use application/xml or text/xml (although the latter is not recommended).

    If either of those conditions are not satisfied, the document is not XHTML.
    Birnam wood is come to Dunsinane

  5. #5
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,048
    Mentioned
    187 Post(s)
    Tagged
    2 Thread(s)
    Off Topic:

    OMG
    xmlns='http://www.w3.org/1999/xhtml'
    10 years already!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •