[英]what persistence layer (xml or mysql) should i use for this xml data?
i wonder how i could store a xml structure in a persistence layer. 我不知道如何将XML结构存储在持久层中。
cause the relational data looks like: 导致关系数据如下所示:
<entity id="1000070">
<name>apple</name>
<entities>
<entity id="7002870">
<name>mac</name>
<entities>
<entity id="7002907">
<name>leopard</name>
<entities>
<entity id="7024080">
<name>safari</name>
</entity>
<entity id="7024701">
<name>finder</name>
</entity>
</entities>
</entity>
</entities>
</entity>
<entity id="7024080">
<name>iphone</name>
<entities>
<entity id="7024080">
<name>3g</name>
</entity>
<entity id="7024701">
<name>3gs</name>
</entity>
</entities>
</entity>
<entity id="7024080">
<name>ipad</name>
</entity>
</entities>
</entity>
as you can see, it has no static structure but a dynamical one. 如您所见,它没有静态结构,而是动态结构。 mac got 2 descendant levels while iphone got 1 and ipad got 0.
Mac获得2个后代级别,而iPhone获得1个级别,而iPad获得0个级别。
i wonder how i could store this data the best way? 我想知道如何才能最好地存储这些数据? what are my options.
我有什么选择。 cause it seems impossible to store it in a mysql database due to this dynamical structure.
由于这种动态结构,似乎无法将其存储在mysql数据库中。
is the only way to store it as a xml file then? 是将其存储为xml文件的唯一方法吗? is the speed of getting information (xpath/xquery/simplexml) from a xml file worse or greater than from mysql?
从xml文件中获取信息(xpath / xquery / simplexml)的速度是比mysql差还是更大?
what are the pros and cons? 优缺点都有什么? do i have other options?
我还有其他选择吗? is storing information in xml files, suited for a lot of users accessing it at the same time?
将信息存储在xml文件中,适合许多同时访问它的用户吗?
would be great with feedbacks!! 反馈会很棒!! thanks!
谢谢!
EDIT: now i noticed that i could use something called xml database to store xml data. 编辑:现在我注意到我可以使用一种称为xml数据库的东西来存储xml数据。 could someone shed a light on this issue?
有人可以阐明这个问题吗? cause apparently its not as simple as just store data in a xml file?
原因显然不像将数据存储在xml文件中那样简单吗?
entity
has a 0..1 relation to entities
, and entities
has a 0..* relation to entity
. entity
有0..1关系到entities
和entities
拥有0 .. *关系entity
。
This is not the exact SQL, and most likely not valid in any DBMS, but should help you get started: 这不是确切的SQL,很可能在任何DBMS中都无效,但是应该可以帮助您入门:
CREATE TABLE entity (
id int(10) AUTOINCREMENT NOT NULL,
xid int(10) NOT NULL,
name char(30) NOT NULL,
entities_id int(10) REFERENCES entities.id NULL,
PRIMARY KEY(id)
)
CREATE TABLE entities (
id int(10) AUTOINCREMENT NOT NULL,
entityref_id int(10) REFERENCES entityref.id NOT NULL,
PRIMARY KEY(id)
)
CREATE TABLE entityref (
id int(10) NOT NULL,
entity_id int(10) REFERENCES entity.id NOT NULL,
PRIMARY KEY(id,entity_id)
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.