物事を提案し、必要なときにいつでも助けてくれてありがとう.
昨日、私はxmlからデータを解析してデータベースに保存する必要があるasp.net 4.0でWebアプリケーションを開発しようとしていました。しかしその前に、それを検証する必要もあります。
.net が提供するツール xsd.exe を使用してスキーマ ファイルを生成しようとしましたが、必須のノードまたは属性をマークする方法がわかりません。
私のxmlのように、以下の項目は必須です
Root node <Market>
<Login> and its sub element
<ProductType> and its <ProductTypeID/>
The attribute DML is mandatory but should have only 3 values NONE, PUT or MODIFY
<ProductType> may or may not have <ProductItem>
If <ProductItem> is present then it should have <ProductItemID>
<ProductItem> may or may not have <Brand>
If <Brand> is present then it should have <BrandID>
以下は私のxmlです
<?xml version="1.0" encoding="utf-8" ?>
<Market>
<Login>
<LoginId />
<Password />
</Login>
<ProductType DML="NONE">
<ProductTypeID/>
<Name/>
<Detail/>
<ProductItem DML="PUT">
<ProductItemID/>
<Name/>
<Detail/>
<Brand DML="PUT">
<BrandID/>
<Name/>
<Detail/>
</Brand>
<Brand DML="MODIFY">
<BrandID/>
<Name/>
<Detail/>
</Brand>
</ProductItem>
<ProductItem DML="MODIFY">
<ProductItemID/>
<Name/>
<Detail/>
</ProductItem>
</ProductType>
</Market>
xsd が要件に従って生成されるように、すべての必須およびオプションのパラメーターをどこでどのように指定する必要がありますか。
ありがとう、
M.