Real Estate Forums

MLS listings and IDX Solutions Discuss implementation of MLS / IDX solutions, MLS providers and how to improve conversion using the multiple listings service available in your area.

Reply
 
Thread Tools Display Modes
Old 01-26-2006, 03:29 PM
wilco wilco is offline
New real estate webmaster
 
Join Date: Jan 2006
Location: Tacoma, WA
Posts: 4
wilco is on a distinguished road
Send a message via ICQ to wilco Send a message via AIM to wilco Send a message via MSN to wilco Send a message via Yahoo to wilco
Default From XML to MySQL

I have access to my local MLS's listings via an XML feed and need some advice for how to insert this data into a MySQL database. The first hurdle is taking the zipped xml file containing everything to initally populate my tables. I need to make sense of this xml file and determine how to convert it into a query that will insert all the relevant data correctly. Any advice or info on where to start looking would be much appreciated!
Reply With Quote
Old 01-27-2006, 02:14 AM
Aaron Aaron is offline
Real Estate Webmasters Staff
 
Join Date: Jun 2005
Location: Nanaimo
Posts: 7,466
Aaron is on a distinguished road
Send a message via MSN to Aaron
Default Re: From XML to MySQL

Importing XML into MySql Can Be a interesting challenge.This software will allow you to do it manually, might help? http://www.navicat.com/

What you really need is a PHP script of some sort that will parse the XML. This page might help with that http://ca.php.net/xml


Aaron
Reply With Quote
Old 01-27-2006, 03:13 PM
wilco wilco is offline
New real estate webmaster
 
Join Date: Jan 2006
Location: Tacoma, WA
Posts: 4
wilco is on a distinguished road
Send a message via ICQ to wilco Send a message via AIM to wilco Send a message via MSN to wilco Send a message via Yahoo to wilco
Default Re: From XML to MySQL

You know, I actually have Navicat and just yesterday finally got it to import correctly.

You're right though, what I really need is a PHP script that I can run as a CRON job periodically to update the DB (manually doing that is of course the worst idea ever ;-) ).

I'll take a look at that link - thanks for the help! If anyone else knows of some good resources, feel free to point me towards them.
Reply With Quote
Old 10-19-2006, 08:51 PM
PeterDillon PeterDillon is offline
New real estate webmaster
 
Join Date: Oct 2006
Posts: 1
PeterDillon is on a distinguished road
Default Re: From XML to MySQL

you can use xslt to transform your xml into sql.

<?xml version="1.0" ?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xslutput method="text" />
<xsl:template match="text()" />

<xsl:template match="IDX_LISTING_DATA_FEED">
INSERT INTO
<xsl:value-of select="@tablename"/> (
<xsl:for-each select="LISTING/*">
<xsl:if test="position()=last()"><xsl:if test="starts-with(name(),'FIELD')"><xsl:value-of select="@fieldname"/></xsl:if></xsl:if>
<xsl:if test="position()!=last()"><xsl:if test="starts-with(name(),'FIELD')"><xsl:value-of select="@fieldname"/>,</xsl:if></xsl:if>
</xsl:for-each> ) VALUES (
<xsl:for-each select="LISTING/*">
<xsl:if test="position()!=last()"><xsl:if test="starts-with(name(),'FIELD')">'<xsl:value-of select="."/>',</xsl:if></xsl:if>
<xsl:if test="position()=last()"><xsl:if test="starts-with(name(),'FIELD')">'<xsl:value-of select="."/>'</xsl:if></xsl:if>
</xsl:for-each>);
</xsl:template>
</xsl:stylesheet>

is a style sheet im working on to convert csv into sql. You then just transform your source xml into sql using php or asp etc.

peter
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



For our members

Main Sections

IDX Coverage Areas

Spiders Welcome

All times are GMT -7. The time now is 07:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.