What does “xmlns” in XML mean?

后端 未结 5 1370
春和景丽
春和景丽 2020-11-22 02:59

I saw the following line in an XML file:

xmlns:android=\"http://schemas.android.com/apk/res/android\"

I have also seen xmlns i

5条回答
  •  囚心锁ツ
    2020-11-22 03:16

    It defines an XML Namespace.

    In your example, the Namespace Prefix is "android" and the Namespace URI is "http://schemas.android.com/apk/res/android"

    In the document, you see elements like:

    Think of the namespace prefix as a variable with a short name alias for the full namespace URI. It is the equivalent of writing with regards to what it "means" when an XML parser reads the document.

    NOTE: You cannot actually use the full namespace URI in place of the namespace prefix in an XML instance document.

    Check out this tutorial on namespaces: http://www.sitepoint.com/xml-namespaces-explained/

提交回复
热议问题