现在我知道这并不新鲜,而且真的,我在网站上进行了大量研究,寻找类似的问题。我有一个这样的xml数据:
<CanvasResult>
<TotalPages>1</TotalPages>
<CurrentPage>1</CurrentPage>
<Submissions>
<Submission Id="2257280">
<Form Id="414131">
<Name>NATIONAL CENSUS MOBILE PORTAL</Name>
<Status>published</Status>
<Version>1</Version>
</Form>
<Date>2013.05.26 10:38:16</Date>
<DeviceDate>2013.05.26 11:43:48</DeviceDate>
<UserName>talk2sexydainty1@yahoo.com</UserName>
<FirstName>Kalifat</FirstName>
<LastName>Census</LastName>
<ResponseID>2A5B1951-1369565028972</ResponseID>
<Sections>
<Section>
<Name>Census Data Capture Portal</Name>
<Screens>
<Screen>
<Name>Census Data Capture Portal</Name>
<Responses>
<Response>
<Label>FirstName:</Label>
<Value>ajape</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>LastName:</Label>
<Value>quadri</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>ID Number:</Label>
<Value>58rs5</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Nationality:</Label>
<Value>Nigerian</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Marital Status:</Label>
<Value>Married</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Date Of Birth:</Label>
<Value>08/26/2000</Value>
<Type>Date</Type>
</Response>
<Response>
<Label>Gender:</Label>
<Value>Male</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Residential Address:</Label>
<Value>No godwon omonua</Value>
<Type>Multi-Line Text</Type>
</Response>
<Response>
<Label>Phone No:</Label>
<Value>08134463976</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Disability</Label>
<Value>NO</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Photo Capture</Label>
<Value>130268022</Value>
<Type>Image Capture</Type>
</Response>
<Response>
<Label>Education:</Label>
<Value>Degree</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Ex Convict:</Label>
<Value>NO</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Career:</Label>
<Value>eCommerce</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Work Experience:</Label>
<Value>Average</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Current Employer:</Label>
<Value>primeplastichem nig ltd</Value>
<Type>Text Box</Type>
</Response>
</Responses>
</Screen>
</Screens>
</Section>
</Sections>
</Submission>
<Submission Id="2263781">
<Form Id="414131">
<Name>NATIONAL CENSUS MOBILE PORTAL</Name>
<Status>published</Status>
<Version>1</Version>
</Form>
<Date>2013.05.28 12:12:51</Date>
<DeviceDate>2013.05.28 12:05:01</DeviceDate>
<UserName>talk2sexydainty1@yahoo.com</UserName>
<FirstName>Kalifat</FirstName>
<LastName>Census</LastName>
<ResponseID>2A5B1951-1369739101634</ResponseID>
<Sections>
<Section>
<Name>Census Data Capture Portal</Name>
<Screens>
<Screen>
<Name>Census Data Capture Portal</Name>
<Responses>
<Response>
<Label>FirstName:</Label>
<Value>micheal</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>LastName:</Label>
<Value>eniolade</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>ID Number:</Label>
<Value>1256</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Nationality:</Label>
<Value>Nigerian</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Marital Status:</Label>
<Value>Single</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Date Of Birth:</Label>
<Value>01/28/1986</Value>
<Type>Date</Type>
</Response>
<Response>
<Label>Gender:</Label>
<Value>Male</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Residential Address:</Label>
<Value>Orisunbare</Value>
<Type>Multi-Line Text</Type>
</Response>
<Response>
<Label>Phone No:</Label>
<Value>08039255000</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Disability</Label>
<Value>NO</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Photo Capture</Label>
<Value>130574405</Value>
<Type>Image Capture</Type>
</Response>
<Response>
<Label>Education:</Label>
<Value>Degree</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Ex Convict:</Label>
<Value>NO</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Career:</Label>
<Value>Information Technology</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Work Experience:</Label>
<Value>Expert</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Current Employer:</Label>
<Value>micheal</Value>
<Type>Text Box</Type>
</Response>
</Responses>
</Screen>
</Screens>
</Section>
</Sections>
</Submission>
<Submission Id="2288255">
<Form Id="414131">
<Name>NATIONAL CENSUS MOBILE PORTAL</Name>
<Status>published</Status>
<Version>1</Version>
</Form>
<Date>2013.05.31 13:53:51</Date>
<DeviceDate>2013.05.31 13:37:16</DeviceDate>
<UserName>ochonogorf@gmail.com</UserName>
<FirstName>Felix</FirstName>
<LastName>Okechukwu</LastName>
<ResponseID>923297e829f566c6-1370007436433</ResponseID>
<Sections>
<Section>
<Name>Census Data Capture Portal</Name>
<Screens>
<Screen>
<Name>Census Data Capture Portal</Name>
<Responses>
<Response>
<Label>FirstName:</Label>
<Value>Felix</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>LastName:</Label>
<Value>Blaze</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>ID Number:</Label>
<Value>00996325</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Nationality:</Label>
<Value>Nigerian</Value>
<Type>Text Box</Type>
</Response>
<Response>
<Label>Marital Status:</Label>
<Value>Married</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Date Of Birth:</Label>
<Value>05/31/1984</Value>
<Type>Date</Type>
</Response>
<Response>
<Label>Gender:</Label>
<Value>Male</Value>
<Type>Value List</Type>
</Response>
<Response>
<Label>Residential Address:</Label>
<Value>Lagos</Value>
<Type>Multi-Line Text</Type>
</Response>
</Responses>
</Screen>
</Screens>
</Section>
</Sections>
</Submission>
</Submissions>
</CanvasResult>
对不起,我知道它又长又无聊!重要的标签是响应标签值。我创建了一个包含类似字段(名字、姓氏、身份证号等)的 sql 表。我不知道如何最好地获取数据。我在 SSIS 中尝试了 XML Source,但它似乎并没有完全正确地生成 XSD,可能是由于 xml 的结构。我还不是很强壮,虽然我喜欢 ssis.. 我猜向导不会工作.. 我还认为它可能需要编写脚本,因为 xml 数据可能更多或更少。我使用 C# 和 sql 2012。请问有人能告诉我如何有效地将 xml 记录移动到数据库吗?提前致谢