Qualified name in namespace declaration

After reading the MSDN-XAML Namespaces and Understanding the XAML Namespaces , I still don't understand the purpose of having a Qualified Name (QName) .

As an example, take the following description of the namespace:

XMLNS: x = 'HTTP://www.w3.org/1999/XSL/Transform

x is the prefix abbreviated for the full URI (in this case, the URL): http://www.w3.org/1999/XSL/Transform . Then this QName is called xmlns . Definition for QName in mdsn:

This full name, including the prefix, is the lexical form of the qualified name (QName):

What does this mean and why does it exist, since the thet operator already has a locator and a prefix to identify the namespace and name to be used?

+6
source share
1 answer

I think more than a XAML question, it's just an XML namespace question.

The xmlns attribute (special attribute) is the only attribute used in XML to define a namespace. It says: "Here comes the namespace declaration." If you do not add a prefix, then you tell it to set the namespace, which is the value of this attribute, as the default namespace for the page. If you omit completely, the default namespace is considered the value of the attribute (after = and between quotation marks).

XAML is XML and chooses to use the XML engine to declare namespaces. I suppose they could create their own mechanism for this, but since they did not, if you added your namespace, as you hint in your question, without xmlns :, an application that processes XML (in this case, the platform. NET, parses the XAML file) would not know that you are trying to define a namespace; he would think that you were adding an attribute called "x" to the element in which it was defined (which most likely would not be the attribute defined for this element).

More on XML Namespaces

http://www.w3.org/TR/REC-xml/

http://www.w3schools.com/XML/xml_namespaces.asp

http://en.wikipedia.org/wiki/XML_namespace

+1
source

Source: https://habr.com/ru/post/917937/


All Articles