Need to convert xml to html content using php

Hi Guys

I have following xml generated from a flash content editor:


<element>
<position>
	<X>360</X>
	<Y>1807</Y>
 <width>600</width>
 <height>325</height>
</position>
<content><![CDATA[<P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">Jacob Oram</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">Lorem ipsum</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">Lorem ipsum</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">xyz@example.com</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">1800-800-8000(800)</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">1800-800-8000</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">www.example.com</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">5000 Lorem ipsum</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">undefined</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">Lorem ipsum</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="23" COLOR="#000000" LETTERSPACING="0" KERNING="0">Lorem ipsum 97035</FONT></P>]]></content>
<type>text</type>
</element>
<element>
<position>
	<X>126</X>
	<Y>1819</Y>
 <width>200</width>
 <height>300</height>
</position>
<content><![CDATA[full-image-path]></content>
<type>picture</type>
</element>
<element>
<position>
	<X>1446</X>
	<Y>1971</Y>
 <width>150</width>
 <height>150</height>
</position>
<content><![CDATA[full-image-path]></content>
<type>picture</type>
</element>
<element>
<position>
	<X>1361</X>
	<Y>2066</Y>
 <width>50</width>
 <height>57</height>
</position>
<content><![CDATA[full-image-path]></content>
<type>picture</type>
</element>
<element>
<position>
	<X>360</X>
	<Y>838</Y>
 <width>1100</width>
 <height>800</height>
</position>
<content><![CDATA[<P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="59" COLOR="#000000" LETTERSPACING="0" KERNING="0">Lorem,</FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="59" COLOR="#000000" LETTERSPACING="0" KERNING="0"></FONT></P><P ALIGN="LEFT"><FONT FACE="Times New Roman" SIZE="59" COLOR="#000000" LETTERSPACING="0" KERNING="0">It&apos;s great to see your lips are normal again!  I just wanted to say thanks!  Now if you could just take care of that wart, everything will be great!</FONT></P>]]></content>
<type>text</type>
</element>


Can someone tell me how can I save the save the above content as html content using php so that I can store the data into my database?

Thanks again.

Hi,
I would like to suggest you can use online XML convertor to convert, that are easily available.
Regards
Amit

Hi Amit

Thanks for your reply.

Actually I have to get the html on the fly so I can’t use an online converter.

Thanks

Hi Achintya,

Well, do you have a basic programming knowledge? If so, you can use the simpleXML library for it, it is simple :slight_smile:

Regards
Amit