MySQL Forums
Forum List  »  Connector/Node.js

extracting format from xml
Posted by: Nehemiah Clark
Date: January 15, 2011 08:03PM

Hi, I am kinda new to mysql and xml, so thanks in advance:

I have a sample xml file and a DB table. Table looks something like this:

get url | title page | ....| ....|


I am trying to extract specific parts of xml and insert them into the DB table in this format.


get url | title page | A .... | B .... |
www.google.com = pass | google = pass | A1 = pass | B1 = pass|



This is my code thus far:
LOAD DATA INFILE 'testResult.xml' INTO TABLE result FIELDS TERMINATED BY '"' LINES STARTING BY '<td class="';

and this my a little of my xml:
<br/><table border="1" cellspacing="0">
<tr>
<td class="pass"><i>get url</i></td>
<td><a href="http://www.google.com/">http://www.google.com/</a></td>;
</tr>
</table>
<br/><table border="1" cellspacing="0">
<tr>
<td><i>title</i></td>
<td><b>is</b></td>
<td class="pass">Google</td>
</tr>
</table>


How can I modify my code to get the format I need. Its seems I need to get the class= pass tags 1st as x then field name tags 2nd as y, and concat y "=" x, but through the xml. There might not be y everytime there is an x. So this has to be specifically extracted in such a way in which I can get the specific format.



Edited 1 time(s). Last edit at 01/15/2011 08:07PM by Nehemiah Clark.

Options: ReplyQuote


Subject
Written By
Posted
extracting format from xml
January 15, 2011 08:03PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.