开发者

store and query xml data in MySQL

what are the good options to store xml structured data and query the data in MySQL? I know from mysql5.1.5 there is a function ExtractValue() to query the data direct开发者_如何学JAVAly, but due to certain limitations I can only use mysql5.0.x. what I need is to store the data in simple xml format, such as

<person>
<name>My Name</name>
<gender>male</gener>
</person>

And I need to be able to directly query all persons who are male.


I guess you will have to use rex-exps in your SQL in case if MySQL is below V5.1.5. This could be slow if you have a lot of data to drill through. I would consider caching these values in separate indexed columns.


If the RDBMS I have to use does not support XML, I'd put the XML data into one or more tables, depending on what the XML looks like and have both import XML into RDBMS and export XML out of RDBMS.

In this case I'd create a persons table with name and gender columns.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜