什么是QName。

来历:qname是qualified name的简写

构成:由名字空间(namespace)前缀(prefix)以及冒号(:),还有一个元素名称构成

URI references can contain characters not allowed in names, and are often inconveniently long, so expanded names are not used directly to name elements and attributes in XML documents.Instead qualified names are used.[Definition: A qualified name is a name subject to namespace interpretation.] In documents conforming to this specification, element and attribute names appear as qualified names.Syntactically, they are either prefixed names or unprefixed names.

QName有两种,一种带前缀的,一种不带前缀的。QName是特定格式的xml元素。

<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context">
    <context:annotation-config />
</beans> 

beans就是不带前缀的,namespace为
http://www.springframework.org/schema/beans ,
context就是前缀,元素名称为annotation-config,
namespace为http://www.springframework.org/schema/context

最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容