tags:

views:

102

answers:

2

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 directly, 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.

+1  A: 

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.

clops
A: 

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.

Vinko Vrsalovic