Hi all,
I am quite new in using php. I need to convert string bellow to XML. The string should comes from jquery(it is json object).
{“@attributes”:{“id”:”3″,”name”:”Cell”},”image”:”images/img1.jpg”,”linkItem”:[{“@attributes”:{“itemType”:”reaction”,”itemId”:”1″,”itemName”:”O2 bubble exchange”},”area”:[{“@attributes”:{“width”:”50″,”height”:”250″,”top”:”0″,”left”:”150″}},{“@attributes”:{“width”:”100″,”height”:”250″,”top”:”100″,”left”:”150″}}],”point”:{“@attributes”:{“top”:”200″,”left”:”20″}}},{“@attributes”:{“itemType”:”entity”,”itemId”:”1″,”itemName”:”CO2″},”area”:[{“@attributes”:{“width”:”50″,”height”:”300″,”top”:”0″,”left”:”250″}},{“@attributes”:{“width”:”10″,”height”:”50″,”top”:”300″,”left”:”150″}}]}]}
wanted XML structure is for example :
<?xml version=”1.0″encoding=”UTF-8″?>
<visualisation id=”3″name=”Cell”>
<image>images/cell.png</image>
<linkItem itemType=”reaction”itemId=”1″itemName=”O2d”>
<area width=”50″height=”250″top=”0″left=”150″/>
<area width=”100″height=”250″top=”100″left=”150″/>
<point top=”200″left=”20″/>
</linkItem>
<linkItem itemType=”reaction”itemId=”3″itemName=”O2d”>
<area width=”50″height=”250″top=”0″left=”150″/>
<area width=”100″height=”250″top=”100″left=”150″/>
<point top=”200″left=”20″/>
</linkItem>
</visualisation>
Please do you have some ideas to do that without need to create complicated parser ? ?
thank you sooo much for answer ahead ?