から階層的なXMLを作成します。は、私は3つのテーブルを持つSQL Serverデータベースを持っていると私は、これらのテーブルから階層構造を持つXMLファイルを作成する必要があるSQL Serverテーブル
ProductID ProductLanguageID ProductDefaultShopID ProductNumber ProductName ProductPrice
------------------------------------------------------------------------------------------
[email protected]@Inc LANG2 Inc 100101 ABC 159,61
[email protected]@Inc LANG2 Inc 100102 BCD 159,61
[email protected]@Inc LANG2 Inc 100105 FRE 159,61
[email protected]@Inc LANG2 Inc 100106 GDE 159,61
秒が持っているグループ
GroupID GroupLanguageID GroupName GroupNumber
------------------------------------------------------------
[email protected]@Inc LANG2 AAA 1
[email protected]@Inc LANG2 BBB 1.01
[email protected]@Inc LANG2 CCC 1.02
[email protected]@Inc LANG2 DDD 1.03
[email protected]@Inc LANG2 GGG 1.12
への接続を持っているドント第三の言語
LanguageID LanguageCode2 LanguageName
----------------------------------------
LANG1 ES Spain
LANG2 EN English
私も2つのテーブルを持っている:
一つのテーブルには、製品が含まれています別のテーブル:
私はT-SQLとC#(ASPを使用することができ<?xml version="1.0" encoding="utf-8"?>
<root>
<productgroup1>
<groupname>AAA</groupname>
<productgroup2>
<groupname>BBB</groupname>
<productgroup3>
<groupname>CCC</groupname>
<products>
<product>
<itemName>ABC</itemName>
<itemNumber>100303</itemNumber>
<itemPrice>159.61</itemPrice>
<ExtraProductgroup>
<extraProductgroupName>GGG</extraProductgroupName>
<itemName>FRE</itemName>
<itemNumber>100305</itemNumber>
<itemPrice>159.61</itemPrice>
</ExtraProductgroup>
</product>
<product>
<itemName>BCD</itemName>
<itemNumber>100302</itemNumber>
<itemPrice>159.61</itemPrice>
</product>
</products>
</productgroup3>
</productgroup2>
</productgroup1>
</root>
:
グループ関係表
GroupRelationsGroupID GroupRelationsParentID
--------------------------------------------
[email protected]@Inc [email protected]@Inc
[email protected]@Inc [email protected]@Inc
[email protected]@Inc [email protected]@Inc
[email protected]@Inc [email protected]@Inc
グループ製品のリレーション表
GroupProductRelationGroupID GroupProductRelationProductID
-------------------------------------------------------------
[email protected]@Inc [email protected]@Inc
[email protected]@Inc [email protected]@Inc
[email protected]@Inc [email protected]@Inc
は、XML出力は次のような構造を持っている必要があります。ネットWebフォーム)。助けて!!! :-)
私はそのデータから、そのXMLを取得する方法を参照してくださいません。たとえば、itemColorはどこから来たのですか? ExtraProductgroupはどうですか?誰かにチャンスを与えたいなら、少なくとも与えられた入力から手作業で所望の出力を作成してください。それ以外の場合は、ここで推測しています。 –
あなたはProductNumberとProductIDを持っていてProductIDは '@@ Inc'の番号です - 実際の* IDは何ですか?奇妙に思えます...どちらも他のデータのどこかに見つけられません。プロダクトはどのようにグループに結びついていますか?グループは階層的にネストされているようです。最大の深さはありますか?グループテーブルに含まれていないグループとグループの関係保留ID ... **このサンプルデータをフィッティングして、このデータにフィッティングしてください** ** [MCVE](http:// stackoverflow。 COM /ヘルプ/ MCVE)(コードまたは[フィドル](www.sqlfiddle.com) – Shnugo