Xml 为什么';tns&x27;wsdl文件中的type元素中不需要前缀?
作为一名新生,我正在努力学习Xml 为什么';tns&x27;wsdl文件中的type元素中不需要前缀?,xml,web-services,soap,wsdl,Xml,Web Services,Soap,Wsdl,作为一名新生,我正在努力学习wsdl。我对XML或其他任何东西都没有完全的了解。我只知道基本知识。我看到wsdl中的基本类型通常是xml模式,所以使用了xsd:stringetc 我的问题是: 在WSDL-type元素中,它内部的tns前缀不像用于operations元素那样使用。为什么? 我附上了一个教程网站的摘录 <xs:schema xmlns:xs= "http://www.w3.org/2001/XMLSchema" targetNamespace=
wsdl
。我对XML或其他任何东西都没有完全的了解。我只知道基本知识。我看到wsdl中的基本类型通常是xml模式,所以使用了xsd:string
etc
我的问题是:
在WSDL-type元素中,它内部的tns
前缀不像用于operations元素那样使用。为什么?
我附上了一个教程网站的摘录
<xs:schema
xmlns:xs= "http://www.w3.org/2001/XMLSchema"
targetNamespace= "http://jenkov.com/MyService/schema"
xmlns:tns= "http://jenkov.com/MyService/schema">
<xs:element name="latestTutorialRequest" type="typeLatestTutorialRequest"/>
<xs:complexType name="typeLatestTutorialRequest">
<xs:sequence>
<xs:element name="date" type="xs:date"/>
</xs:sequence>
</xs:complexType>
<xs:element name="latestTutorialResponse" type="xs:string"/>
<xs:element name="invalidDateError" type="xs:string"/>
</xs:schema>
是不是应该
<xs:schema
xmlns:xs= "http://www.w3.org/2001/XMLSchema"
targetNamespace= "http://jenkov.com/MyService/schema"
xmlns:tns= "http://jenkov.com/MyService/schema">
<xs:element name="latestTutorialRequest" type="**tns:typeLatestTutorialRequest**"/>
<xs:complexType name="typeLatestTutorialRequest">
<xs:sequence>
<xs:element name="date" type="xs:date"/>
</xs:sequence>
</xs:complexType>
<xs:element name="latestTutorialResponse" type="xs:string"/>
<xs:element name="invalidDateError" type="xs:string"/>
</xs:schema>
我同意,所写的模式是错误的。这就是撒克逊人对它的看法:
Saxon-EE 9.8.0.6J from Saxonica
Java version 1.8.0_121
Using license serial number V005192
Loading schema document file:/Users/mike/Desktop/temp/test.xsd
Error at xs:element on line 6 column 80 of test.xsd:
Cannot reference schema components in the null namespace as it has not been imported
Schema processing failed: One error was found while processing the schema