首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > J2SE开发 >

QName的有关问题(表示 XML 规范中定义的限定名称):命名空间Uri、本本地部分localPart、前缀它们代表是什么意思啊

2011-12-20 
QName的问题(表示 XML 规范中定义的限定名称):命名空间Uri、本本地部分localPart、前缀它们代表是什么意思啊

QName的问题(表示 XML 规范中定义的限定名称):命名空间Uri、本本地部分localPart、前缀它们代表是什么意思啊!
比如有下面一个wsdl:
    <?xml   version= "1.0 "   encoding= "UTF-8 "   ?>  
-   <wsdl:definitions   targetNamespace= "http://127.0.0.1:8080/axis/HelloService.jws "   xmlns:apachesoap= "http://xml.apache.org/xml-soap "   xmlns:impl= "http://127.0.0.1:8080/axis/HelloService.jws "   xmlns:intf= "http://127.0.0.1:8080/axis/HelloService.jws "   xmlns:soapenc= "http://schemas.xmlsoap.org/soap/encoding/ "   xmlns:wsdl= "http://schemas.xmlsoap.org/wsdl/ "   xmlns:wsdlsoap= "http://schemas.xmlsoap.org/wsdl/soap/ "   xmlns:xsd= "http://www.w3.org/2001/XMLSchema ">
-   <!--  
WSDL   created   by   Apache   Axis   version:   1.3
Built   on   Oct   05,   2005   (05:23:37   EDT)

    -->  
-   <wsdl:message   name= "sayHelloResponse ">
    <wsdl:part   name= "sayHelloReturn "   type= "xsd:string "   />  
    </wsdl:message>
-   <wsdl:message   name= "sayHelloRequest ">
    <wsdl:part   name= "username "   type= "xsd:string "   />  
    </wsdl:message>
-   <wsdl:portType   name= "HelloService ">
-   <wsdl:operation   name= "sayHello "   parameterOrder= "username ">
    <wsdl:input   message= "impl:sayHelloRequest "   name= "sayHelloRequest "   />  
    <wsdl:output   message= "impl:sayHelloResponse "   name= "sayHelloResponse "   />  
    </wsdl:operation>
    </wsdl:portType>
-   <wsdl:binding   name= "HelloServiceSoapBinding "   type= "impl:HelloService ">
    <wsdlsoap:binding   style= "rpc "   transport= "http://schemas.xmlsoap.org/soap/http "   />  
-   <wsdl:operation   name= "sayHello ">
    <wsdlsoap:operation   soapAction= " "   />  
-   <wsdl:input   name= "sayHelloRequest ">
    <wsdlsoap:body   encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/ "   namespace= "http://DefaultNamespace "   use= "encoded "   />  
    </wsdl:input>
-   <wsdl:output   name= "sayHelloResponse ">
    <wsdlsoap:body   encodingStyle= "http://schemas.xmlsoap.org/soap/encoding/ "   namespace= "http://127.0.0.1:8080/axis/HelloService.jws "   use= "encoded "   />  
    </wsdl:output>
    </wsdl:operation>
    </wsdl:binding>
-   <wsdl:service   name= "HelloServiceService ">
-   <wsdl:port   binding= "impl:HelloServiceSoapBinding "   name= "HelloService ">
    <wsdlsoap:address   location= "http://127.0.0.1:8080/axis/HelloService.jws "   />  
    </wsdl:port>
    </wsdl:service>
    </wsdl:definitions>
它里面怎么来定义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元素,其作用主要是增加了名字空间,比如有同样的元素名称,而名字空间不同的情况。

我碰到类似的 别人那抄一段给你看下

热点排行