asp.net.ph

Skip Navigation LinksHome > Abakada: Back to Basics > Language References > HTML Element Attributes > XMLNS Attribute

XMLNS Attribute


Declares a namespace for custom tags in an HTML document.

Syntax

Inline <html XMLNS:sNamespace [ = sUrn ] ... >
Script N/A

Possible Values

sNamespace Required. Specifies a namespace that is then used as a prefix to custom tags in a document.
sUrn Optional. Specifies a URN string that uniquely identifies the namespace.

Remarks

The syntax described above to declare a namespace for custom tags in an HTML document is based on the W3C XML Namespace Spec. Although the W3C draft allows namespaces to be declared on all tags, Microsoft® Internet Explorer® supports namespace declaration only on the HTML tag.

Multiple namespaces can be declared on the HTML tag, as shown in the following code:

<html XMLNS:Prefix1 XMLNS:Prefix2="www.microsoft.com">

Example

The following example illustrates how a namespace is declared when one of the default behaviors in Internet Explorer, the clientCaps behavior, is used as a custom tag in an HTML document. Note how the declared MSIE namespace is used as a prefix when referring to the clientCaps tag.

Using the CLIENTCAPS behavior, the sample demonstrates how the Internet Explorer® DataBinding component can be installed, if the component does not already exist in the user's system.

<html XMLNS:MSIE>
<head>
<style>
@media all {
  MSIE\:clientCaps {behavior:url( #default#clientCaps );}
}
</STYLE>

<script language="JavaScript">
function window.onload ( ) {
var bDataBindingAvailable  = false;
var sDataBindingVersion "';
var sDataBindingID = "{333C7BC4-460F-11D0-BC04-0080C7055A83}";
bDataBindingAvailable = oClientCaps.isComponentInstalled ( 
  sDataBindingID,"clsid" );

// if dataBinding is unavailable, install it
if ( !bDataBindingAvailable ) {
  oClientCaps.addComponentRequest ( 
    sDataBindingID, "componentid" );
  bDataBindingAvailable = oClientCaps.doComponentRequest ( );
}
 :
}
-->
</script>
</head>

<body bgcolor="#FFFFFF">
 ...
<MSIE:CLIENTCAPS id="oClientCaps" />
 ...
</body>

 Show me 

Applies To

HTML

See Also

XML Namespaces Spec



Check out related books at Amazon

© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note