<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:admin="http://webns.net/mvcb/"
     xmlns:content="http://purl.org/rss/1.0/modules/content/"
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
	<channel> 

	<title>Comments on: XML to MYSQL</title>
	<link>http://ask.metafilter.com/81541/XML-to-MYSQL/</link>
	<description>Comments on Ask MetaFilter post XML to MYSQL</description>
	<pubDate>Mon, 21 Jan 2008 09:25:50 -0800</pubDate>
	<lastBuildDate>Mon, 21 Jan 2008 09:25:50 -0800</lastBuildDate>
	<language>en-us</language>
	<docs>http://blogs.law.harvard.edu/tech/rss</docs>
	<ttl>60</ttl>

	<item>
		<title>Question: XML to MYSQL</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL</link>	
		<description>Is there a simple way to convert an XML feed into a MYSQL database?  &lt;br /&gt;&lt;br /&gt; Navicat works great, but I&apos;d like something that runs runs on the server, rather than my PC. I&apos;ve seen the old thread asking the same question, but it did not provide any working solutions. Thanks for the help!</description>
		<guid isPermaLink="false">post:ask.metafilter.com,2008:site.81541</guid>
		<pubDate>Mon, 21 Jan 2008 09:19:03 -0800</pubDate>
		<dc:creator>alse</dc:creator>
		
			<category>xml</category>
		
			<category>mysql</category>
		
			<category>convert</category>
		
			<category>navicat</category>
		
			<category>rss</category>
		
			<category>parse</category>
		
	</item> <item>
		<title>By: zsazsa</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1208397</link>	
		<description>You could use &lt;a href=&quot;http://www-128.ibm.com/developerworks/xml/library/x-xslphp1/index.html&quot;&gt;XSLT&lt;/a&gt; to transform the XML into SQL statements that you can run on the mysql server.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1208397</guid>
		<pubDate>Mon, 21 Jan 2008 09:25:50 -0800</pubDate>
		<dc:creator>zsazsa</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1209195</link>	
		<description>&quot;What&apos;s an XML Feed?&quot;, that&apos;s the question. XML can have completely arbitrary levels of nesting and complexity which isn&apos;t necessarily easy to map to a row-and-column database.&lt;br&gt;
&lt;br&gt;
Assuming that your data &lt;em&gt;is &lt;/em&gt;the sort that&apos;s amenable to being put into a database, (perhaps you mean an RSS feed?) &lt;strong&gt;zsazsa&lt;/strong&gt;&apos;s suggestion would work.&lt;br&gt;
&lt;br&gt;
A cron job chops the data up into &quot;insert&quot; statements, saves them into .sql files, cron job runs the files at regular intervals, something like that?&lt;br&gt;
&lt;br&gt;
Otherwise, you&apos;re looking at some kind of script, in Perl or PHP most likely.&lt;br&gt;
&lt;br&gt;
Happy to try and create a script.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1209195</guid>
		<pubDate>Mon, 21 Jan 2008 19:39:35 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item><item>
		<title>By: alse</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1209729</link>	
		<description>I&apos;m looking to parse a feed such as &lt;a href=&quot;http://www.google.com/trends/hottrends/atom/hourly&quot;&gt;this&lt;/a&gt;. I hoped to find something more automatic like Navicat, but it looks like I&apos;ll have to learn to program it myself.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1209729</guid>
		<pubDate>Tue, 22 Jan 2008 08:16:15 -0800</pubDate>
		<dc:creator>alse</dc:creator>
	</item><item>
		<title>By: Skorgu</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1209737</link>	
		<description>Yikes, that&apos;s not even really xml, the good stuff is inside a CDATA. If all you want is to put the &quot;Volcanic&quot;, etc data and the link into a database it&apos;s a one-liner in any scripting language.</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1209737</guid>
		<pubDate>Tue, 22 Jan 2008 08:23:43 -0800</pubDate>
		<dc:creator>Skorgu</dc:creator>
	</item><item>
		<title>By: Skorgu</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1209754</link>	
		<description>Very brittle example: &lt;br&gt;
&lt;verbatim&gt;curl http://www.google.com/trends/hottrends/atom/hourly | perl -nle &apos;while(m/class=&quot;(\S+)&quot;.*href=&quot;(.*)&quot;/g){print &quot;INSERT INTO foo \(bar, baz\) VALUES \( \&quot;$1\&quot; \&quot;$2\&quot;\);&quot;}&apos;&lt;/verbatim&gt;</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1209754</guid>
		<pubDate>Tue, 22 Jan 2008 08:38:45 -0800</pubDate>
		<dc:creator>Skorgu</dc:creator>
	</item><item>
		<title>By: AmbroseChapel</title>
		<link>http://ask.metafilter.com/81541/XML-to-MYSQL#1210562</link>	
		<description>Basically the perl script you want goes something like&lt;br&gt;
&lt;br&gt;
&lt;code&gt;use LWP::Simple;&lt;br&gt;
use DBI;&lt;br&gt;
$dbh = DBI-&amp;gt;connect(&quot;DBI:mysql:database=&amp;lt;foo&amp;gt;&quot;,&amp;lt;username&amp;gt;,&amp;lt;password&amp;gt;);&lt;br&gt;
$page = get(&apos;&amp;lt;url&amp;gt;&apos;);&lt;br&gt;
$sth = $dbh-&amp;gt;prepare(&quot;insert into &amp;lt;table&amp;gt; values ?,?,?&quot;);&lt;br&gt;
while($page =~ /&amp;lt;regular expression which grabs 3 things&amp;gt;/g){&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;$sth-&amp;gt;execute($1,$2,$3);&lt;br&gt;
}&lt;br&gt;
# strict, warnings, add &quot;or die&quot; messages, exercise for the reader etc.&lt;/code&gt;&lt;br&gt;
&lt;br&gt;
How are you going to handle duplicates?</description>
		<guid isPermaLink="false">comment:ask.metafilter.com,2008:site.81541-1210562</guid>
		<pubDate>Tue, 22 Jan 2008 18:31:41 -0800</pubDate>
		<dc:creator>AmbroseChapel</dc:creator>
	</item>
	</channel>
</rss>
