【发布时间】:2012-10-31 04:44:49
【问题描述】:
我需要一些关于以下问题的意见/方向:
我需要一种方法将多个表中的行序列化为 XML,其中值表示为属性,而不是标签。我已经开始深入研究数据集的 WriteXML 方法,但我不确定是否可以按照我需要的方式自定义 XML。格式如下:
<?xml version="1.0" encoding="UTF-8"?>
<Import operatorName="ABC123">
<customers>
<customer id="12345" firstName="Abraham" lastName="Lincoln" dob="02/12/1809">
<addresses>
<address city="the city" state="the state" zip="12345" street="the street">
<address city="the city 2" state="the state 2" zip="54321" street="another street">
</addresses>
<customerEncounters>
<customerEncounter id="797979" date="01/01/2013" location="somewhere">
<customerRepresentative name="The Dude">
<mechanic name="Mr. Mechanic">
</customerEncounter>
</customerEncounters>
<customerEncounters>
<customerEncounter id="888888" date="01/15/2013" location="somewhere else">
<customerRepresentative name="The Dude">
<mechanic name="Mr. Mechanic">
</customerEncounter>
</customerEncounters>
</customer>
<customer>
....
</customer>
</customers>
</Import>
简单来说,表格如下:
客户 ID 名称 名称 出生日期
客户地址 ID 客户ID 街道 城市 状态 邮编
相遇 ID 客户ID 日期 地点 机械师ID 客户代表 ID
机制 ID 名称
客户代表 ID 名称
每个客户可以有很多地址和会面。
每次抓取数据,我都不会获得大量客户(50 或更少)。这甚至可以使用数据集吗?或者有没有更资源友好的方式来做到这一点?
提前致谢。
【问题讨论】:
-
您能描述一下所涉及的表格吗?这个 xml 格式是否是所需的格式。我假设您的“它将采用以下格式”评论指的是所需的输出。