XML Tutorial/Namespace/Attribute

Материал из Web эксперт
Перейти к: навигация, поиск

Namespaces and Attributes

Attributes usually don"t have namespaces the way elements do. 
They are just "associated" with the elements to which they belong. 
<person xmlns="http://www.wbex.ru"
    <name id="25">
The id attribute is not part of this namespace.
The id attribute is simply associated with the <name> element.
If you used prefixes, you could specify that id is in a namespace. 
<a:person xmlns:a="http://www.wbex.ru"
    <a:name a:id="25"