Namespaces |
|
|
|
|
|
|
|
Two steps in applying a namespace to an XML document |
|
|
|
|
|
|
|
1. Declaring the namespace |
xmlns:prefix="uri" |
<model xmlns:mod="http://jacksonelect.com/models"> |
|
|
|
2. Identifying the elements and attributes within the document that belong to that namespace |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The general form for applying a qualified name to a two-sided tag is: |
<prefix:element> … </prefix:element> |
This is applying a namespace to an element |
|
|
|
To apply a namespace to an attribute |
<element prefix:attribute="value"> … </element> |
|
|
|
|
Default namespace syntax |
<element xmlns="uri"> … </element> |
Omit prefix in namespace declaration |
Usually use on html element |
|
To declare a namespace in a style sheet, you add the following rule to the style sheet file |
@namespace prefix url(uri); |
@namespace mod url(http://designingcontent.com/models); |
|
|
Applying a namespace to a selector |
prefix|selector {attribute:value;} |
mod|title {width: 150px;} |
For IE browsers, use \: instead of | |