Using LOAD XML in MySQL, trying to bypass trivial labels

pakhackerz

New Member
I'm trying to use LOAD XML to load an XML file into MySQL. My problem is that many of the fields in the XML file have trivial tags and attributes that I'd like to ignore. For example for this XML:\[code\]<list> <Patient> <Text>PA9</Text> <Species>Human</Species> </Patient></list>\[/code\]I would like to produce\[code\]+---------+| Patient |+---------+| PA9 |+---------+\[/code\]The best I can do right now is manually deleting the undesired attributes:\[code\]<Patient>PA9</Patient>\[/code\]And executing\[code\]>CREATE TABLE People (Patient VARCHAR(20));>LOAD XML LOCAL INFILE '~/file.xml' INTO TABLE People ROWS IDENTIFIED BY '<Patient>';\[/code\]Which gives the desired result, but is impractical for large files. Is there any way to automatically pick a desired attribute and ignore the rest?Note: There are many Patient objects in my actual file, I included only one to simplify the question.This is my first post, if I've formatted wrong or am unclear please let me know.
 
Back
Top