Add Site or Add Page to Favorites
 

 XML Atttributes in HTML 

Clarify the meaning of the acronyms on your web site.

Acronym Dictionary

Acronym Finder

Get information on your favorite TV Shows at TV Series .com

Social Networking Web Sites


Printer-friendly PDF* format:

HTML 5 Atttribute Reference

XML Attributes in HTML

In general, namespaces are useful for aggregating together content from different sources. The namespace that qualifies the element names avoids conflicts among the element names from different sources. The global attributes in the XML namespace may be useful when including content from other XML sources or when parsing HTML documents as general-purpose XML. The xmlns attribute is useful for creating other types of objects which can be handled by custom-designed code, using JavaScript for example.

The xml:base Attribute

The xml:base HTML attribute

The xml:base attribute

Examples

                                 <span ="">...</span>
                                 
The xml:id Attribute

The xml:id HTML attribute

The HTML id attribute serves the same purpose as the xml:id attribute and should be used instead.

Examples

                                 <span id="elementId-1">...</span>
                                 
The xml:lang Attribute

The xml:lang HTML attribute

The HTML lang attribute serves the same purpose as the xml:lang attribute and should be used instead. However, the prefixed xml:lang attribute is sometimes used on the html element.

Examples

                                 <dt lang="fr-CA">de rigeur</dt>
                                 
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
The xml:space Attribute

The xml:space HTML attribute

The xml:space attribute determines whether any white space in the content of the element or its descendants is to be preserved.

Examples

                                 <span ="">...</span>
                                 
xmlns Attribute and Prefix

The xmlns HTML attribute

The xmlns attribute sets the default namespace URI for the current element and any of its descendants.

                                 <special xmlns="http://ExampleOnly.com/namespace/">
                                 
<p xmlns="http://www.w3.org/1999/xhtml">This paragraph is truly HTML, but its parent is "special".
</p>
</special>

Although it may be coded at any level, it typically appears only on the top-level html element. The value of the xmlns attribute for HTML tags is http://www.w3.org/1999/xhtml the same as for the 2000 W3C standard HTML.

                                 <?xml version="1.0" encoding="UTF-8"?>
                                 
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
...
</html>

Using xmlns as a prefix associates a namespace URI with the user-specified namespace prefix following the xmlns: part of the attribute name.

                                 <special xmlns="http://ExampleOnly.com/namespace/" xmlns:html="http://www.w3.org/1999/xhtml">
                                 
<html:p>This paragraph is truly HTML, but its parent is "special".
</html:p>
</special>

You typically would only see something like this when HTML is aggregated with non-HTML content with element names from a different namespace.

Last updated Sunday September 19, 2010

You are currently viewing this page in HTML 5 non-XML* format (* see Clicklets for more infomation). This document is also available in XHTML 1 Style Sheet*XHTML 1* XML*HTML 5 Style Sheet*HTML 5 XML*HTML 4* XHTML Mobile* WML Mobile* and printer-friendly PDF* formats. This is accomplished with Single Source Publishing, a content management system that uses templates in XSLT style sheets provided by XML Styles .com to transform the source content for various content delivery channels. There is also RDF* metadata that describes the content of this document.


Copyright © 2010 Accilent® Corp. Alteration of content, including addition of any function such as hypertext links or pop-up advertising, or interference with the hypertext links or other functions of this site is expressly prohibited.

DISCLAIMER: All information, links, forms, applications and other items on this site or obtained from it are provided AS IS, WITHOUT WARRANTY OF ANY KIND EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.