1. 程式人生 > >使用SQLXML將XML檔案對映到關係資料庫

使用SQLXML將XML檔案對映到關係資料庫

1. My Computer-->System Properties-->Advanced-->Environment Variables
 add D:/Program Files/Microsoft Visual Studio 8/SDK/v2.0/Bin/ to path
2. cmd-->cd thePathOfXmlFile-->xsd.exe BTCAL.xml
3. Edit BTCAL.xsd:
 a. update
  xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"-->xmlns:sql="urn:schemas-microsoft-com:mapping-schema"
  xs:choice-->xs:sequence
 b. delete:
  msdata:IsDataSet="true" msdata:UseCurrentLocale="true"
 c. add:
  sql:is-constant="1"
  sql:relation="table"
  sql:field="tableField"
 d. sometime need add:
                <xs:annotation>
                  <xs:appinfo>
                    <sql:relationship parent-key="SN" child="tChild" child-key="SN" />
                  </xs:appinfo>
                </xs:annotation>
         
condition:
 setup msxml6.msi & sqlxml.msi(the sample use sqlxml3(sp3))    
reference:
 

http://msdn.microsoft.com/zh-cn/library/ms171781(v=SQL.100).aspx
 http://msdn.microsoft.com/zh-cn/library/ms171878(v=SQL.100).aspx
sample:(http://cdwolfling.download.csdn.net/
 BTCAL.xml
 BTCAL.xsd