starcwl
starcwl

Reputation: 406

what is the attribute namespace in XML tag?

my svg file content below:

<svg xmlns="http://www.w3.org/2000/svg"
     xmlns:xlink="http://www.w3.org/1999/xlink"
     width="15cm" height="15cm">
</svg>

what is the width's namespace? is default namespace or "xlink". If you know the answer, could you give w3school reference?

Upvotes: 1

Views: 165

Answers (2)

har07
har07

Reputation: 89295

width attribute is neither in default namespace nor xlink namespace. It is, instead, in empty namespace. Attribute need an explicit namespace prefix to be in a namespace (from XML namespace spec, emphesize mine) :

"Default namespace declarations do not apply directly to attribute names; the interpretation of unprefixed attributes is determined by the element on which they appear."

See previous discussion on this topic here : XML Default namespaces for unqualified attribute names?

Upvotes: 1

Tobias Maslowski
Tobias Maslowski

Reputation: 41

The Namespace of width is the same as the one <svg /> is in! While Elements inherit their default-Namespaces from the enclosing elements, attributes are retrieving them from the element they belong to.

w3c Reference

Upvotes: 0

Related Questions