当今将复杂 XML(API 外部,包括 .xsd 方案)导入关系数据库或任何数据库的最简单、最自动化的方法是什么? - 我理解应该有一个(半) 为每个数据库自动导入它的方法,我只是还没有找到它? *
这也来自为什么对关系数据使用 XML complification 的问题?为什么来自关系数据库的 API 数据不应该在最多一个 API 用户中结束,通常也按行传输? Table VS xml / json / yaml - table requires less storage if data is any related? more efficient than compression
:)
最佳答案
您正在寻找一种通用工具。然而,XML 的概念从根本上与(关系)数据库的概念不兼容。
您正在寻找的通用工具应该至少涵盖三种基本类型的操作:
- a) The XML is defined as a projection of a table/row/field concept
<xml>
<table name='myTable'>
<row id='1'>
<field name='myField1' type='string'>myValue1</field>
<field name='myField2' type='date'>01-01-1901</field>
<field name='myField3' type='number'>123456</field>
</row>
</table>
</xml>
- b) The XML is to be stored in one XML field in one row of a table
Id Name Date XML
-- ---- ---------- -------------------------
1 MyEx 01-01-2001 <myObject>
<myAttribute name='class'>example</myAttribute>
</myObject>
- c) The XML is a projection of a parent/child relationship in the database
<xml>
<order number='123'>
<customer id='1001'>myCustomer</customer>
<orderDate>01-01-2001</orderDate>
<address>wherever to go</address>
<orderDetails>
<orderProduct code='P01'>
<name>myProduct</name>
<amount>15</amount>
<listPrice>$14.00</listPrice>
</orderProduct>
</orderDetails>
</order>
</xml>
在每种情况下,该工具都必须指定是否允许您导入一个或多个此类对象,并且该工具必须能够将值的表示形式转换为可接受的存储格式。
所有这些并非不可能,但重要的是检查您选择的工具将支持哪些功能。
关于mysql - 自动将特定的 XML + XSD 转换/导入数据库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21738024/