how to store xml structure in a persistence layer?
- by fayer
i wonder how i could store a xml structure in a persistence layer.
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.
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.
is the only way to store it as a xml file then? is the speed of getting information (xpath/xquery/simplexml) from a xml file worse or greater than from 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?
would be great with feedbacks!! thanks!