Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-21-2004, 01:04 PM   PM User | #1
aufkes
New to the CF scene

 
Join Date: Aug 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
aufkes is an unknown quantity at this point
PHP script to convert XML to HTML

Hi folks,
I have two questions.

I'm looking for a PHP script to convet a XML file to a HTML file on the fly. Do you know where I can find this?.

On the other hand, I create a PDF file using PHP. When the PDF is open on a new web browser, and after a delay of 1 minute, the PDF file must be delete from the server directory. I've try with this PHP instructions:

sleep(60);
unlink("$result"); -->where $result has the link to the pdf file.

but something is worng because I can open the file before delete it (of course). Any ideas.

Thank
aufkes is offline   Reply With Quote
Old 08-21-2004, 06:29 PM   PM User | #2
mordred
Senior Coder


 
Join Date: Jun 2002
Location: frankfurt, german banana republic
Posts: 1,848
Thanks: 0
Thanked 0 Times in 0 Posts
mordred is an unknown quantity at this point
Quote:
Originally Posted by aufkes
I'm looking for a PHP script to convet a XML file to a HTML file on the fly. Do you know where I can find this?.
There is no script that can convert any XML file to a HTML file, because the script can't figure out for each and every XML file what and how it should convert it. You'll have to build your own routine that transforms the XML file by help of SAX, DOM or XSLT. If you tell us what kind of XML file it is, there may be a premade PHP script to do the conversion. But a general transformer does not exist.
__________________
De gustibus non est disputandum.
mordred is offline   Reply With Quote
Old 11-05-2012, 07:02 AM   PM User | #3
achintya
New to the CF scene

 
Join Date: Jan 2006
Location: India
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
achintya is an unknown quantity at this point
Question

Hi Guys

I have the following xml generated from flash editor:

Quote:
<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-000-0000 (000)</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 you please help me get a html content from the above xml using php?

Thanks in advance.
achintya is offline   Reply With Quote
Old 11-05-2012, 07:42 PM   PM User | #4
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
A little ancient of a thread to dig up.
There is no methodology to convert direct XML into HTML. That is why there are XSLT's and DOCTypes. Use an XSLT to convert it at the client level, or run the XSL through the XSLTProcessor object to apply it to the DOMDocument of the XML.
Fou-Lu is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:13 PM.


Advertisement
Log in to turn off these ads.