简体   繁体   English

XML Schema无法与Web Service Software Factory一起使用

[英]XML Schema not working with Web Service Software Factory

I am trying to create an XML schema to use with the Web Service Software Factory. 我正在尝试创建一个XML模式以与Web服务软件工厂一起使用。 It's a fairly simple schema that is just a group of person objects. 这是一个相当简单的模式,只是一组人物对象。 The (simplified) schema file looks like: (简化)模式文件如下所示:

<?xml version="1.0" encoding="utf-8" ?> 
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
    elementFormDefault="qualified" 
    xmlns="http://tempuri.org/XMLSchema.xsd"
    xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
    xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="Persons" type="PersonsType" />

    <xs:complexType name="PersonsType">
        <xs:sequence>
            <xs:element name="Person" type="PersonType" minOccurs="0"
                maxOccurs="unbounded" />
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="PersonType">
        <xs:all>
            <xs:element name="PersonName" type="xs:string" />
            <xs:element name="PersonAge" type="xs:integer" />
        </xs:all>
    </xs:complexType>

</xs:schema>

It's a simple collection of person elements with a parent element called Persons. 它是一个简单的person元素集合,其中包含一个名为Persons的父元素。

When I try to validate my .serviceContract file I get the error 'The file name 'Persons.xsd' is not compliant with the DataContactSerializer'. 当我尝试验证我的.serviceContract文件时,我得到错误'文件名'Persons.xsd'不符合DataContactSerializer'。

Does anybody know how to fix this schema so that it will work with the Web Service Software Factory? 有没有人知道如何修复此架构,以便它可以与Web服务软件工厂一起使用? And for bonus points, the next structure that I have to worry about will be a recursive list of corporations. 而对于奖励积分,我不得不担心的下一个结构将是一个递归的公司列表。 Any suggestions about how to make recursive schemas that work with WSSF would be appreciated as well. 关于如何制作与WSSF一起使用的递归模式的任何建议也将受到赞赏。

Did you already try to avoid named types? 你有没有试过避免命名类型?

<?xml version="1.0" encoding="utf-8" ?> 
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd"
  elementFormDefault="qualified" 
  xmlns="http://tempuri.org/XMLSchema.xsd"
  xmlns:mstns="http://tempuri.org/XMLSchema.xsd"
  xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xs:element name="Persons">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="Person" minOccurs="0" maxOccurs="unbounded">
                    <xs:complexType>
                        <xs:all>
                            <xs:element name="PersonName" type="xs:string" />
                            <xs:element name="PersonAge" type="xs:integer" />
                        </xs:all>
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
         </xs:complexType>
    </xs:element>

Also you may try to change <xs:all> to <sequence> in your <Person>. 您也可以尝试将<xs:all>更改为<Person>中的<sequence>。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM