首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >XML架构不能与Web服务软件工厂一起使用

XML架构不能与Web服务软件工厂一起使用
EN

Stack Overflow用户
提问于 2010-02-03 01:54:52
回答 1查看 613关注 0票数 3

我正在尝试创建一个XML模式,以便与Web服务软件工厂一起使用。这是一个相当简单的模式,它只是一组person对象。(简化的)模式文件如下所示:

代码语言:javascript
复制
<?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>

它是一个简单的person元素集合,其中包含一个名为Persons的父元素。

当我尝试验证我的.serviceContract文件时,我得到了错误“文件名'Persons.xsd‘不符合DataContactSerializer’”。

有没有人知道如何修复此模式,使其与Web服务软件工厂一起工作?对于奖励积分,我必须担心的下一个结构将是公司的递归列表。任何关于如何使递归模式与WSSF一起工作的建议也将不胜感激。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2010-02-04 18:47:38

您是否已经尝试避免使用命名类型?

代码语言:javascript
复制
<?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>

此外,您可以尝试在中将更改为。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/2186357

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档