mysql 解析xml文件,解析xml文件并将其存储到数据库中

Is there a generic/automatic way in R or in python to parse xml files with its nodes and attributes, automatically generate mysql tables for storing that information and then populate those tables.

解决方案

Regarding

Is there a generic/automatic way in R

to parse xml files with its nodes and

attributes, automatically generate

mysql tables for storing that

information and then populate those

tables.

the answer is a good old yes you can, at least in R.

The XML package for R can read XML documents and return R data.frame types in a single call using the xmlToDataFrame() function.

And the RMySQL package can transfer data.frame objects to the database in a single command---including table creation if need be---using the dbWriteTable() function defined in the common DBI backend for R and provided for MySQL by RMySQL.

So in short: two lines can do it, so you can easily write yourself a new helper function that does it along with a commensurate amount of error checking.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值