Parsing an XML file and storing it in a database

Whether there is a general / automatic way in R or in python to parse XML files with its nodes and attributes, it automatically generates mysql tables to store this information, and then populates these tables.

+3
source share
4 answers

Relatively

Is there a general / automatic way in R to parse XML files with its nodes and attributes, automatically generate mysql tables to store this information, and then populate these tables.

response to the good old, you can, at least in the R .

XML R XML- R data.frame xmlToDataFrame().

RMySQL data.frame --- , --- dbWriteTable(), DBI backend R MySQL RMySQL.

, : , , .

+5

: , . python, "". , .

, XML , SQL - , . , XML, .

+4

XML XML R RMySQL R MySQL.

. XML , MySQL, -, XML, , .

+1

We sometimes do something similar at work, but not on python. In this case, for each use, the user program must be recorded. We only have the SAX parser. Using an XML decoder to get a dictionary / hash in one step will help a lot.

At least you will need to say which tags map to tables and fields, no pre-existing lib can know that ...

0
source

Source: https://habr.com/ru/post/1775603/


All Articles