使用 XML 和 XSD 创建填充数据库 [英] Using XML and XSD to create a populated database

查看:54
本文介绍了使用 XML 和 XSD 创建填充数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不确定这是否可能,但我想我会问一下,看看我能不能得到任何信息.

I'm not sure if this is possible, but figured I'd ask and see if I can get any info.

正如标题所示,我有一个包含数千行的 XML 文件.我也有其关联的 XSD 架构文件.

As the title suggests, I have an XML file with thousands of lines. I also have its associated XSD schema file.

我想知道,我是否可以在不手动指定 XPath 的情况下将这些数据转换为 MySQL 数据库?

I was wondering, is it possible for me to convert this data into a MySQL database without manually specifying the XPath stuff?

例如,Java 或 Python 或任何程序是否可以基于 XSD 分析 XML 结构、提取表列并用数据填充它?

For example, is it possible for a Java or Python or whatever program to analyse the XML structure, based on the XSD, extract the table columns, and populate it with data?

我尝试使用 PHPMyAdmin 导入我的 XML 文件,但它不起作用并说有问题,我认为这与它无法创建列有关.据我所知,它可以更好地处理 CSV 文件,因此这是 2 阶段转换的另一种选择.

I tried using PHPMyAdmin to import my XML file, but it didn't work and said there was a problem, which I think was related to the fact that it couldn't create the columns. As far as I know, it can handle CSV files better, so that's another option for a 2 stage conversion.

谢谢.

推荐答案

使用 XMLImport 将带有 XSD 的 XML 加载到 Excel 中,另存为 CSV 或格式化为所需的 XML 格式,例如 Wordpress,然后导入 MySQL.

Use XMLImport to load the XML with XSD into Excel, save as CSV or format into the desired XML format such as Wordpress, then import into MySQL.

这篇关于使用 XML 和 XSD 创建填充数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆