SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Evangelist achintya's Avatar
    Join Date
    Apr 2005
    Location
    Chandannagar(India)
    Posts
    459
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Question Need to convert xml to html content using php

    Hi Guys

    I have following xml generated from a flash content editor:

    Code:
    <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.

  2. #2
    Non-Member
    Join Date
    Nov 2012
    Location
    Indore
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    I would like to suggest you can use online XML convertor to convert, that are easily available.
    Regards
    Amit

  3. #3
    SitePoint Evangelist achintya's Avatar
    Join Date
    Apr 2005
    Location
    Chandannagar(India)
    Posts
    459
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    Non-Member
    Join Date
    Nov 2012
    Location
    Indore
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Achintya,

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

    Regards
    Amit


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •