[转载]javax.xml.namespace.QName是什么
2012-06-02 15:04
405 查看
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 “
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:
Element
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
An attribute named
An attribute named
Here is an example of a complete document using elements from two namespaces:
In this example, the
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
templateis in the XSLT namespace, and element
hris 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
xmlnsattribute located in some element. This attribute can have two forms:
An attribute named
xmlns='defines the namespace URI of the default namespace. This namespace is associated with all elements and attributes that have unqualified names.nsURI'
An attribute named
xmlns:'[/code] associates the givenprefix='[code]nsURI
prefixwith 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
templateelement is in the XSLT namespace. The
hrelement is in the default namespace, which is associated with the XHTML namespace URI.
相关文章推荐
- javax.xml.namespace.QName 解释以及作用JDK
- Axis: rt.jar和jaxrpc中javax.xml.namespace.QName冲突问题分析
- javax.xml.namespace.QName
- javax.xml.namespace.QName
- weblogic javax/xml/namespace/QName报错
- android studio错误解决finished with non-zero exit value 1 【javax/xml/namespace/QName.class】
- javax.xml.namespace.QName
- Weblogic 9.2 启动时报错 javax.xml.namespace.QName
- weblogic启动异常:Parsing Failure in config.xml: javax.xml.namespace.QName; local class incompatible
- symbol:constructor Service(java.net.URL,javax.xml.namespace.QName,javax.xml.ws.WebServiceFeature
- Java 异常 —— java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible
- javax.xml.ws.Service 报错The constructor Service(URL, QName, WebServiceFeature[]) is undefined的解决方案
- javax.xml.ws.Service 报错The constructor Service(URL, QName, WebServiceFeature[]) is undefined的解决方案
- javax.xml.namespace.QName类的用法
- 转载:java_min的专栏-webservcie生成客户端代码报错----javax.xml.ws.soap.SOAPFaultException: Cannot create a secure X
- javax.xml.ws.Service 报错The constructor Service(URL, QName, WebServiceFeature[]) is undefined的解决方案
- xmlns是什么——XML Namespace Explained
- Spring框架的两个简化XML配置文件的p-namespace和c-namespace
- 转载-----通过xml处理sql语句时对小于号与大于号的处理转换
- XML之文档对象模型DOM(上)[转载]