`

困扰了我很久的QName

阅读更多

API 上就这几句:

     

public class QName

extends java.lang.Object
implements java.io.Serializable

QName class represents the value of a qualified name as specified in XML Schema Part2: Datatypes specification.

The value of a QName contains a namespaceURI, a localPart and a prefix. The localPart provides the local part of the qualified name. The namespaceURI is a URI reference identifying the namespace.

 

网上查找的:

1.来历:qname是qualified name 的简写
2.构成:由名字空间(namespace)前缀(prefix)以及冒号(:),还有一个元素名称构成
3.举例:
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
     xmlns="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
     version="1.0">
<xsl:template match="foo">
    <hr/>
</xsl:template>
</xsl:stylesheet>
xsl是名字空间前缀,template是元素名称,xsl:template 就是一个qname
4.总结:qname无非是有着特定格式的xml元素,其作用主要是增加了名字空间,比如有同样的元素名称,而名字空间不同的情况。

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics