Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 7 of 7

Thread: What is XMLNS ?

  1. #1
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Member #
    14707
    Can someone please explain to me what XMLNS is? i have wiki'd it but need some clarification.
    If someone adds XMLNS in their <head> does that simply mean they are following XMLNS Standars ? (as agreed by W3C)

    Thanks

  2.  

  3. #2
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Basically, yes. xmlns in HTML is a sign that someone is using XHTML. The particular attribute refers to the XML Namespace of the element.

  4. #3
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Member #
    14707
    Thanks for the response.
    So if you declare XMLNS in the head, it means you are going to be using XML.
    XML attributes you use later on must conform to XMLNS - by using particular elements!?!?

  5. #4
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Member #
    14707
    anyone!?

  6. #5
    Senior Member Eddy Bones's Avatar
    Join Date
    Jan 2004
    Location
    Washington, USA
    Posts
    1,054
    Member #
    4651
    If you use the xmlns attribute you conform to XHTML. You don't conform to XMLNS because XMLNS is nothing, you conform to the XMLNS that you decide you're going to use, in this case the XHTML namespace. The particular elements you use are those of XHTML.

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    XMLNS is a reference to an XML namespace (NS), which is a prefix in your XML document that is used to associate elements to a schema. Usually, in single-schema docs, just the default (no prefix) namespace reference is used. Multiple namespace prefixes are used in XML documents when they reference multiple schemas.

    Prefixes are rare in XHTML, because most XHTML docs only contain html. However, you could use a namespace in any XML document, even a plain XHTML doc, as follows:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html 
         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <xh:html xmlns:xh="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <xh:head>
        <xh:title>Virtual Library</xh:title>
      </xh:head>
      <xh:body>
        <xh:p>Moved to <xh:a href="http://example.org/">example.org</xh:a>.</xh:p>
      </xh:body>
    </xh:html>
    Note that the above is a valid XHTML document, though some browsers wouldn't render it properly, which is why people don't prefix their XHTML docs.

    A better example of a valid (and effective) use of namespaces can be seen below:
    ws:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html 
         PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
      <head>
        <title>Virtual Library</title>
      </head>
      <body>
        <p>Moved to <a href="http://example.org/">example.org</a>.</p>
        <tx:transaction id="12345" xmlns:tx="http://www.transio.com/schemas/transaction.xsd">
            <tx:customer id="1" name="Steve">
                <tx:credit-card type="mastercard" number="411111111111111" cvv="123" expiration="01/2010"/>
            </tx:customer>
            <tx:products>
                <tx:product id="1" name="Shoes" quantity="2" cost="19.99" />
                <tx:product id="2" name="Socks" quantity="2" cost="1.99" />
            </tx:products>
        </tx:transaction>
      </body>
    </html>
    In the second example, the tx namespace is used to differentiate my proprietary embedded XML from the XHTML.

    Hope this helps.

  8. #7
    Junior Member
    Join Date
    Jan 2007
    Posts
    17
    Member #
    14707
    Thanks


Remove Ads

Posting Permissions

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

Search tags for this page

web layout using xmlns

Click on a term to search for related topics.
All times are GMT -6. The time now is 11:10 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com