2011-02-19 4 views
1

私はXsd2Codeを使用してXMLスキーマからクラスを生成しています。これは、次のようないくつかの複雑な型のために働く:Xsd2Codeは特定のフィールドを省略します

<xs:complexType name="AsiguratB1Type"> 
     <xs:sequence> 
      <xs:element name="asiguratB11" type="AsiguratB11Type" minOccurs="0" maxOccurs="10"/> 
     </xs:sequence> 
     <xs:attribute name="B1_1" type="typ:TipAsiguratSType" use="required"/> 
     <xs:attribute name="B1_2" type="typ:FlagSType" use="required"/> 
     <xs:attribute name="B1_3" type="typ:TipContractSType" use="required"/> 
     <xs:attribute name="B1_4" type="typ:OreNormaZiSType" use="required"/> 
     <xs:attribute name="B1_5" type="typ:Pozitiv15SType"/> 
     <xs:attribute name="B1_6" type="typ:Pozitiv3SType"/> 
     <xs:attribute name="B1_7" type="typ:Pozitiv3SType"/> 
     <xs:attribute name="B1_8" type="typ:Pozitiv3SType"/> 
     <xs:attribute name="B1_9" type="typ:Pozitiv2SType"/> 
     <xs:attribute name="B1_10" type="typ:Pozitiv15SType"/> 
     <xs:attribute name="B1_15" type="typ:Pozitiv2SType"/> 
    </xs:complexType> 

...他人(以下の例)のために、それはちょうど空白クラス(のみ直列化ルーチン、ノーフィールド)を発生します。

<xs:complexType name="AngajatorAType"> 
     <xs:complexContent> 
      <xs:restriction base="xs:anyType"> 
       <xs:attribute name="A_codOblig" type="typ:CodObligSType" use="required"/> 
       <xs:attribute name="A_codBugetar" type="typ:CodBugetarSType" use="required"/> 
       <xs:attribute name="A_datorat" type="typ:Pozitiv15SType" use="required"/> 
       <xs:attribute name="A_deductibil" type="typ:Pozitiv15SType"/> 
       <xs:attribute name="A_plata" type="typ:Pozitiv15SType" use="required"/> 
      </xs:restriction> 
     </xs:complexContent> 
    </xs:complexType> 

同じことは、VS2010のツールセットからXsd.exeではで発生します。 問題になると思いますか?

+0

テストケースを作成できますか?つまり、動作が再現可能な単純なXMLスキーマですか? –

+0

タグの間に配置された属性は、クラス内で生成されないようです。私は問題のATMを探しています。 – Rimio

+0

W3Schoolsから: "complexContent要素は、混合コンテンツまたは要素のみを含む複合型の拡張または制限を定義します"。私の場合の基底型は "anyType"なので、制約はなく、C#の "object"に対応しているので、complexContentタグが重複しているのだろうと思います。 – Rimio

答えて

0

これは設計によるものだと思います。制限は、新しい属性や要素などを基本型に追加することはできません。

+0

不要なタグを削除し、結果を取り戻すつもりです。私は、XMLが第三者のソフトウェアによって正しく解析されることを願っています。 – Rimio

0

4.0フレームワークをターゲットにしているときに、xsd2codeがminOccus = 0をどのように処理しているかという問題があると思います。それを一時的に削除して、シリアル化されているものを見ることができますか?

また、3.5のフレームワークをターゲットにしてxml属性を含めることもできます。

関連する問題