Welcome to WebmasterWorld Guest from 54.196.232.162

Forum Moderators: httpwebwitch

Message Too Old, No Replies

Converting XML structure to XML structure

Converting XML structure to XML structure

     
8:36 pm on May 12, 2010 (gmt 0)

New User

5+ Year Member

joined:May 12, 2010
posts: 1
votes: 0




Hello guys

Here is the story.

I do have a real estate website which is having the option to import XML files.
My website XML structure its quite simple and looks like this:
<?xml version='1.0' ?>
<listings>
<listing>
<id></id>
<user_id></user_id>
<category_id></category_id>
<package_id></package_id>
<usr_pkg></usr_pkg>
<date_added></date_added>
<date_expires></date_expires>
<title></title>
<description></description>
<price></price>
<currency></currency>
<country></country>
<region></region>
<city></city>
<zip></zip>
<meta_description></meta_description>
<meta_keywords></meta_keywords>
<sold></sold>
<rented></rented>
<viewed></viewed>
<user_approved></user_approved>
<active></active>
<pending></pending>
<featured></featured>
<highlited></highlited>
<priority></priority>
<video></video>
<rating></rating>
<language></language>
<property_type></property_type>
<bedrooms></bedrooms>
<bathrooms></bathrooms>
<area></area>
<year_built></year_built>
<estate_condition></estate_condition>
<amenities></amenities>
<community_amenities></community_amenities>
<type1></type1>
<category></category>
<pictures></pictures>
</listing>
</listings>
Now i have a an XML file and i would like to import it into my website, but this XML structure its not as MY website XML structure. This XML structure looks like this.
<?xml version='1.0' encoding='UTF-8' ?>
<root>
<feed_version>2</feed_version>
<property>
<id></id>
<date></date>
<ref></ref>
<price>0</price>
<price_freq>sale</price_freq>
<part_ownership>0</part_ownership>
<leasehold>0</leasehold>
<type>
<en>Villa</en>
</type>
<town></town>
<province></province>
<location_detail></location_detail>
<beds>0</beds>
<baths>0</baths>
<pool>0</pool>
<surface_area>
</surface_area>
<url></url>
<desc>
<en> </en>
<es> </es>
</desc>
<images>
<image id="1">
<url></url>
<title>
<en></en>
</title>
</image>
<image id="2">
<url></url>
<title>
<en></en>
</title>
</image>
<image id="3">
<url></url>
<title>
<en></en>
</title>
</image>
<image id="4">
<url></url>
<title>
<en></en>
</title>
</image>
</images>
</property>
So i am in need of some tool or software to be able to convert it with less intervention from my self as much as is possible. To look like my XML website structure.
To get a little bit more deeper its possible to make a script or a component something to get the XML over the internet and to import it automatically lets say everyday or from time to time ?
I am trying to explain as much as i can but i think you got the idea.
My website its written in PHP.

Thanks a lot
4:25 am on May 20, 2010 (gmt 0)

Moderator This Forum from CA 

WebmasterWorld Administrator httpwebwitch is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Aug 29, 2003
posts:4059
votes: 0


All that you suggest are possible using PHP.

To transform one XML file into another, you might use XSLT [php.net].
Or, you might parse the XML using an XML parser [php.net], and build a new one by concatenating strings [php.net] together.

Then to have it done daily without intervention, you will set up that script as a cron job [webmasterworld.com].

Good luck!
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members