2010-02-02 2 views
3

웹 서비스 소프트웨어 팩토리에서 사용할 XML 스키마를 만들려고합니다. 이것은 매우 단순한 스키마로, 이는 단지 개인 객체의 그룹입니다. 그것은 사람이라는 부모 요소 인 요소의 단순한 모음입니다웹 서비스 소프트웨어 팩토리에서 XML 스키마가 작동하지 않습니다.

<?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> 

:처럼 (간체) 스키마 파일 보인다.

내가 오류 '파일 이름'Persons.xsd을 얻을 내 .serviceContract 파일의 유효성을 검사 할

'는 DataContactSerializer을 준수하지 않는'.

사람은 웹 서비스 소프트웨어 팩토리와 함께 작동 할 수 있도록이 스키마를 해결하는 방법을 알고 있나요? 그리고 보너스 포인트를 위해, 내가 걱정해야 할 다음 구조는 기업의 재귀 목록이 될 것입니다. WSSF에서 작동하는 재귀 스키마를 작성하는 방법에 대한 제안도 감사 할 것입니다.

답변

1

이미 명명 된 형식을 피하려고 했습니까?

<?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> 
또한 당신이 < XS를 변경하려고 할 수 있습니다 : 모든 > 당신의 < 사람 >에서 > 순서 <합니다.

+0

@fiburt : 당신의 도움을 주셔서 감사하지만이 시도하고 일을해야 루트 시퀀스를 가져올 수 없습니다 'http://tempuri.org/XMLSchema.xsd을'네임 스페이스 '는 minOccurs' '유형'사람 '을 얻었다. 형식을 데이터 계약 형식에 매핑하거나 ImportXmlType을 사용하거나 다른 serializer를 사용할 수 있도록 스키마를 변경하십시오. " –

관련 문제