Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/15.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 为什么';tns&x27;wsdl文件中的type元素中不需要前缀?_Xml_Web Services_Soap_Wsdl - Fatal编程技术网

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