Edit XML with php script
€8-30 EUR
Thanh toán khi bàn giao
In an xml file I have this structure (with <post>repeating) :
<data>
<post>
<deal_id>479</deal_id>
<deal_title><![CDATA[Δίπλωμα Μηχανής, στη Σχολή Οδηγών Παραστατίδης στον Εύοσμο, μόνο με 49€]]></deal_title>
<deal_url>[login to view URL]</deal_url>
<deal_city><![CDATA[Θεσσαλονίκη]]></deal_city>
<deal_price><![CDATA[49]]></deal_price>
<deal_previous_price><![CDATA[125]]></deal_previous_price>
<deal_discount><![CDATA[60.8]]></deal_discount>
<deal_start><![CDATA[2016-01-10 00:00:00]]></deal_start>
<deal_end><![CDATA[2016-04-01 00:00:00]]></deal_end>
<deal_image>
<image>
<file>[login to view URL]</file>
<title>c700x420</title>
<caption></caption>
<description></description>
<alt></alt>
</image>
<image>
<file>[login to view URL]</file>
<title>diploma1</title>
<caption></caption>
<description></description>
<alt></alt>
</image>
</deal_image>
<deal_sales><![CDATA[0]]></deal_sales>
<deal_active><![CDATA[true]]></deal_active></post></data>
and I would like to transform the <deal_image> to
<deal_image>[login to view URL]</deal_image>
which means keep only the first appearing jpg and discard the rest..and do that for all <post>
Can you do that with php?
So the desired output would be something like this:
<data>
<post>
<deal_id>479</deal_id>
<deal_title><![CDATA[Δίπλωμα Μηχανής, στη Σχολή Οδηγών Παραστατίδης στον Εύοσμο, μόνο με 49€]]></deal_title>
<deal_url>[login to view URL]</deal_url>
<deal_city><![CDATA[Θεσσαλονίκη]]></deal_city>
<deal_price><![CDATA[49]]></deal_price>
<deal_previous_price><![CDATA[125]]></deal_previous_price>
<deal_discount><![CDATA[60.8]]></deal_discount>
<deal_start><![CDATA[2016-01-10 00:00:00]]></deal_start>
<deal_end><![CDATA[2016-04-01 00:00:00]]></deal_end>
<deal_image>[login to view URL]</deal_image>
<deal_sales><![CDATA[0]]></deal_sales>
<deal_active><![CDATA[true]]></deal_active></post></data>
Note that the deal_image tag kept only the url of the first image and ignored the rest. In my xml file there are lots of <post></post> sections, which should also be processed in an iteration.
ID dự án: #9580381
Về dự án
9 freelancer chào giá trung bình€28 cho công việc này
Hi! I can do xml trnasformation in php! Feel free to contact me. We can finish your project quickly.
I can show the complex xml generation that I did for Google KML files. if you award the project quickly you can get it all sorted within few hours. i will give you php script that makes the conversion.
i am a professional Web Developer, html5 , php5, JavaScript , jquery , jquery mobile, Wordpress, android developer ,bootstrap3 , PhotoShop , CodeIgniter . i am doing PHP and MySQL from 2006 till now , i almost 10 year Thêm