1

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?

2 Answers 2

1

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?

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.