June 21, 2000 - XML Namespaces
June 21, 2000 XML Namespaces Tips: June 2000
Yehuda Shiran, Ph.D.
|
<HTML XMLNLOR="#000066"><HTML XMLNS:DOCJS>
<HEAD>
<STYLE>
@media all {
DOCJS\:RIGHT {text-align:right; width:100}
}
</STYLE>
</HEAD>
<BODY>
<DOCJS:RIGHT>
Read Doc JavaScript's columns, tips, tools, and tutorials
</DOCJS:RIGHT>
</BODY>
</HTML>
As shown above, the namespace we use is DOCJS
:
<HTML XMLNS:DOCJS>
XMLNS stands for XML NameSpace. We defined a custom tag called RIGHT
. Every use of this tag should be prefixed by the appropriate XML namespace, to create the new tag DOCJS:RIGHT
. If namespaces are not defined, the custom tag is treated as an unknown tag when the document is parsed. Although navigating to a page with an unknown tag does not result in an error, the new custom tag is not able to contain other tags, nor can behaviors be applied to it. It is also possible to define multiple namespaces on a single HTML tag:
<HTML XMLNS:DOCJS XMLNS:DOCJAVASCRIPT>