我有一个将事件日志输出到 xml 文件的设备,我想将该数据输入到 mysql 数据库中。我想使用 LOAD XML,但我不确定我是如何尝试搜索论坛的,但我无法找到答案。XML 文件如下所示:
<response>
<ROW0>:0000,dp0,54321,1,g1,00/00/00-00.00;:0001,dp0,54321,1,g1,00/00/00-00.00;:0002,dp0,54321,1,g1,00/00/00-00.00;:0003,dp0,54321,1,g1,00/00/00-00.00;:0004,dp0,54321,1,g1,00/00/00-00.00;:0005,dp0,54321,1,g1,00/00/00-00.00;:0006,dp0,54321,1,g1,00/00/00-00.00;:0007,dp0,54321,1,g1,00/00/00-00.00;:0008,dp0,54321,1,g1,00/00/00-00.00;:0009,dp0,54321,1,g1,00/00/00-00.00;:0010,dp0,54321,1,g1,00/00/00-00.00;:0011,dp0,54321,1,g1,00/00/00-00.00;:0012,dp0,54321,1,g1,00/00/00-00.00;:0013,dp0,54321,1,g1,00/00/00-00.00;:0014,dp0,54321,1,g1,00/00/00-00.00;:0015,dp0,54321,1,g1,00/00/00-00.00;:0016,dp0,54321,1,g1,00/00/00-00.00;:0017,dp0,54321,1,g1,00/00/00-00.00;:0018,dp0,54321,1,g1,00/00/00-00.00;:0019,dp0,54321,1,g1,00/00/00-00.00;:0020,dp0,54321,1,g1,00/00/00-00.00;:0021,dp0,54321,1,g1,00/00/00-00.00;:0022,dp0,54321,1,g1,00/00/00-00.00;:0023,dp0,54321,1,g1,00/00/00-00.00;:0024,dp0,54321,1,g1,00/00/00-00.00;:0025,dp0,54321,1,g1,00/00/00-00.00;:0026,dp0,54321,1,g1,00/00/00-00.00;:0027,dp0,54321,1,g1,00/00/00-00.00;:0028,dp0,54321,1,g1,00/00/00-00.00;:0029,dp0,54321,1,g1,00/00/00-00.00;:0030,dp2,00106,3,g2,18/06/12-20.02;:0031,dp2,00106,3,g2,18/06/12-20.02;:0032,dp2,00106,3,g2,18/06/12-20.03;:0033,dp2,00106,3,g2,18/06/12-20.04;:0034,dp2,00106,3,g2,18/06/12-23.10;:0035,dp2,00106,3,g2,18/06/12-23.10;:0036,dp2,00106,3,g2,18/06/12-23.10;:0037,dp2,00106,3,g2,18/06/12-23.11;:0038,dp2,00106,3,g2,18/06/12-23.11;:0039,dp2,00106,3,g2,18/06/12-23.15;:0040,dp2,00106,3,g2,18/06/12-23.15;:0041,dp2,00106,3,g2,18/06/12-23.16;:0042,dp2,00106,3,g2,18/06/12-23.16;:0043,dp2,00106,3,g2,18/06/12-23.20;:0044,dp2,00106,3,g2,18/06/12-23.21;:0045,dp2,00106,3,g2,18/06/12-23.21;:0046,dp2,00106,3,g2,18/06/12-23.21;:0047,dp2,00106,3,g2,18/06/12-23.22;:0048,dp2,00106,3,g2,18/06/12-23.22;:0049,dp2,00106,3,g2,18/06/12-23.22;:0050,dp2,00106,3,g2,18/06/12-23.23;:0051,dp2,00106,3,g2,18/06/12-23.23;:0052,dp2,00106,3,g2,18/06/12-23.23;:0053,dp2,00106,3,g2,18/06/12-23.23;:0054,dp2,00106,3,g2,18/06/12-23.24;:0055,dp2,00106,3,g2,18/06/12-23.24;:0056,dp2,00106,3,g2,18/06/12-23.24;:0057,dp2,00106,3,g2,18/06/12-23.24;:0058,dp2,00106,3,g2,18/06/12-23.27;:0059,dp3,00110,3,g2,18/06/12-23.31;:0060,dp3,00110,3,g2,18/06/12-23.31;:0061,dp2,00106,3,g2,18/06/12-23.31;:0062,dp2,00106,3,g2,18/06/12-23.32;:0063,dp2,00106,3,g2,18/06/12-23.34;:0064,dp2,00106,3,g2,18/06/12-23.34;:0065,dp2,00106,3,g2,18/06/12-23.34;:0066,dp2,00106,3,g2,18/06/12-23.34;:0067,dp2,00106,3,g2,18/06/12-23.35;:0068,dp2,00106,3,g2,18/06/12-23.35;:0069,dp2,00106,3,g2,18/06/12-23.36;:0070,dp2,00106,3,g2,18/06/12-23.36;:0071,dp2,00106,3,g2,18/06/12-23.37;:0072,dp2,00106,3,g2,18/06/12-23.38;:0073,dp3,00110,3,g2,18/06/12-23.38;:0074,dp2,00106,3,g2,18/06/12-23.38;:0075,dp2,00106,3,g2,18/06/12-23.39;:0076,dp2,00106,3,g2,18/06/12-23.39;:0077,dp2,00106,3,g2,18/06/12-23.41;:0078,dp3,00110,3,g2,19/06/12-13.52;:0079,dp3,00110,3,g2,19/06/12-13.52;:0080,dp3,00110,3,g2,19/06/12-13.52;:0081,dp3,00110,3,g2,19/06/12-13.52;:0082,dp2,00106,3,g2,19/06/12-15.32;:0083,dp2,00106,3,g2,19/06/12-15.32;:0084,dp3,00110,3,g2,19/06/12-15.32;:0085,dp3,00110,3,g2,19/06/12-15.32;:0086,dp3,00110,3,g2,19/06/12-15.32;:0087,dp3,00110,3,g2,19/06/12-15.33;:0088,dp3,00110,3,g2,19/06/12-15.51;:0089,dp3,00110,3,g2,19/06/12-15.51;:0090,dp3,00110,3,g2,19/06/12-15.52;:0091,dp3,00110,3,g2,19/06/12-15.52;:0092,dp3,00110,3,g2,19/06/12-15.52;:0093,dp3,00110,3,g2,19/06/12-15.53;:0094,dp3,00110,3,g2,19/06/12-15.53;:0095,dp3,00110,3,g2,19/06/12-15.53;:0096,dp3,00110,3,g2,19/06/12-15.53;:0097,dp3,00110,3,g2,19/06/12-15.54;:0098,dp3,00110,3,g2,19/06/12-15.54;:0099,dp3,00110,3,g2,19/06/12-15.54;</ROW0>
</response>
如您所见,每个单元格用逗号分隔,每行用 ; 分隔:单元格是:事件编号,用户名,代码,门,组,日期和时间此外,每次有人打开门时都会更新 xml 文件,但它只包含 100 行日志。我想要实现的是,这个数据库每小时都会更新 XML 文件中的数据,但如果有意义的话,只会更新新的数据。
有人可以帮我吗?