【发布时间】:2013-12-31 09:57:00
【问题描述】:
我有一个如下所示的 XML 文件:
<?xml version="1.0" encoding="utf-8"?>
<comments>
<row Id="1" PostId="1" Score="3" Text="Maxis uses this in The Sims when clicking on your person to perform actions. ex: call->friend->[friends name]" CreationDate="2010-08-09T19:52:30.690" UserId="12" />
<row Id="2" PostId="1" Score="1" Text="Here are some examples: http://en.wikipedia.org/wiki/Pie_menu#Notable_implementations" CreationDate="2010-08-09T19:54:54.007" UserId="31" />
<row Id="3" PostId="9" Score="13" Text="How about making it short and with less steps :)" CreationDate="2010-08-09T19:55:57.670" UserId="35" />
<row Id="4" PostId="3" Score="1" Text="10 sec seems like an awful lot when you are browsing." CreationDate="2010-08-09T19:57:57.057" UserId="32" />
...
</comments>
我环顾四周,找到了this slightly related question,但它的行看起来像这样:
<row>
<field name="personal_number">539</field>
<field name="firstname">Name</field>
<field name="lastname">Surname</field>
<field name="email">email.domain.com</field>
<field name="start_time">2011-04-02 13:30:00</field>
<field name="end_time">2011-04-02 18:15:00</field>
<field name="employee_category">1,2,4,5,22,37,38,39,41,43,44</field>
</row>
每一行的每个字段都有一个 XML 元素 - 而不是像我一样,每一行都有一个元素,其内容被指定为属性。
如何将其导入 MySQL?我几乎可以使用任何技术,但我更愿意远离任何需要 Windows 的东西。
【问题讨论】: