转载自http://blog.csdn.net/fbysss/archive/2007/06/24/1664076.aspx
作者:fbysss
Blog:blog.csdn.net/fbysss
msn:jameslastchina@hotmail.com
声明:本文章由fbysss整理编写,转载或引用请注明引用地址。
关键字:qname
Qname这个东东,在使用dom4j的时候,经常见到,可能是自己解析的xml都太简单了,所以没有仔细研究过,就是觉得名字很怪异,在google百度搜索“什么是qname”,居然只有几条没有像样答案的纪录。还好,在国外网站上找到了相关的解释,这下基本明白了。
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元素,其作用主要是增加了名字空间,比如有同样的元素名称,而名字空间不同的情况。先了解这么多,请大家补充。
参考地址:
http://infohost.nmt.edu/tcc/help/pubs/pyxml/def-qname.html
原文如下:
A document may contain elements and attributes from more than one namespace URI. Because namespace URIs can be quite lengthy, it is cumbersome to include the complete namespace URI in each element or attribute name.
XML allows a shorthand notation to simplify assigning names to namespaces. You may invent a short namespace prefix and associate it with a namespace URI.
For example, suppose your document contains names from both the XSLT and XHTML namespaces. In this situation, it is customary to associate the namespace prefix “xsl
” with XSLT. You might use prefix “html
” to refer to the XHTML namespace.
A qualified name has three parts:
-
A namespace prefix.
-
A colon character, “:
”.
-
A local name that gives the name of the element or attribute within that namespace.
For example, here is a fragment illustrating the use of qualified names:
<xsl:template match="separator">
<html:hr/>
</xsl:template>
Element template
is in the XSLT namespace, and element hr
is in the HTML namespace.
You can also use an unqualified name, which is just a local name without the namespace prefix. The namespace of such a name is called the default namespace.
The association between a namespace prefix and a namespace URI is made with an xmlns
attribute located in some element. This attribute can have two forms:
-
An attribute named xmlns='nsURI
'
defines the namespace URI of the default namespace. This namespace is associated with all elements and attributes that have unqualified names.
-
An attribute named xmlns:prefix
='nsURI
'
associates the given prefix
with the namespace URI nsURI
.
Here is an example of a complete document using elements from two namespaces:
<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>
In this example, the template
element is in the XSLT namespace. The hr
element is in the default namespace, which is associated with the XHTML namespace URI.
分享到:
相关推荐
qname.jar qname.jar
1. Add the QName JAR file (qname.jar) into the WEB-INF/lib folder in your WAR file 2. Add a file weblogic.xml into the WEB-INF folder in your WAR file Below is an example weblogic.xml file: <!DOCTYPE ...
这个问题曾困扰了我一段时间,无意中看到了网上的一篇文章,看完后真是觉得惭愧啊!还是平时的粗心大意造成的啊!
xmlbeans-qname.jar
js-qname 简单的QName(命名空间URI +本地名称)JavaScript的对象实现
weblogic javax/xml/namespace/QName报错-附件资源
jsr173_1.0_api.jar rasolver.jar xbean.jar xbean_xpath.jar xmlbeans-qname.jar xmlpublic.jar
使用axis1.3构建自己的SOAP应用程序源码; 详细介绍了如何使用ant脚本构建SOAP,以及如何测试SOAP接口。 详细可查看本人博客:使用axis1.3构建自己的SOAP应用程序源码
a master paper about repository of bpel
本备忘录介绍域名系统...6-2-8 QNAME=USC-ISIC.ARPA, QTYPE=CNAME 6-3 解析举例 6-3-1 解析ISI.EDU.的MX 6-3-2 获得地址26.6.0.65的主机名 6-3-3 获得poneria.ISI.EDU的主机地址 第7章 参考文献和参考书目 原文索引
about weblogic service , tell u how to use weblogic
内附dom4j-1.6.1.rar(内有dom4j-1.6.1.jar包和附加包),解析xml详解文档,解析xml的java源码。
0、包含xbean.jar xmlbeans-qname.jar jsr173_1.0_api.jar resolver.jar 1、使用xmlbeans通过xsd文件创建bean所需jar包; 2、xmlbeans可以去git上下载:git://git.apache.org/xmlbeans.git 3、命令如: D:\xmlbeans\...
xml.....>时,会调用startDocument()方法,当读入的时候,由于它是个ElementNode,所以会调用startElement(String uri, String localName, String qName, Attributes attributes) 方法,其中第二个参数就是节点的...
jsr173_1.0_api.jar;resolver.jar;xbean.jar;xbean_xpath.jar;xmlbeans-qname.jar;xmlpublic.jar
主要介绍了关于weblogic部署Java项目的包冲突问题的解决,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧
解决javax.xml jar包缺失的问题,引进javax.xml.rpc-api-1.1.1.jar
感谢“雪飘寒”原创与分享 目录 dom4j实例详解 1 目录 1 一、dom4j介绍 2 二、使用dom4j创建xml文档 3 三、使用dom4j解析xml文件 5 1. 构建dom4j树 5 2. 获取节点 5 ...六、Qname介绍 10 七、Visitor模式 11
[QName] [nchar](10) NULL, [QPass] [nchar](10) NULL, [QSex] [nchar](10) NULL, [QAccount] [nchar](50) NULL, [QMemo] [nchar](10) NULL ) Oracle建库脚本: CREATE TABLE QP_Users( QID int, QName ...