1) { $prexbits=explode("?>", $xbits[1]); $pinxml=str_replace("", "", $pinxml); } $okhtml=@file_get_contents("xml_to_html.html"); $bits=explode('var preinxml="', $okhtml); if (sizeof($bits) > 1) { $subbits=explode('"', $bits[1]); $newhtml=str_replace($subbits[0], str_replace("\n", " ", str_replace("\r", " ", str_replace('"', '\"', str_replace("<","<",str_replace(">",">",urldecode($pinxml)))))), $okhtml); file_put_contents("xmltohtml" . server_remote_addr() . ".html", $newhtml); header("Location: xmltohtml" . server_remote_addr() . ".html"); exit; } else { header("Location: ./xml_to_html.html?inxml=" . $_POST['inxml']); exit; } } $inxml="<messages> <note id='501'> <to>Tove</to> <from>Jani</from> <heading>Reminder</heading> <body>Don't forget me this weekend!</body> </note> <note id='502'> <to>Jani</to> <from>Tove</from> <heading>Re: Reminder</heading> <body>I will not</body> </note></messages>"; file_put_contents("messages.xml", str_replace("<", "<", str_replace(">", ">", $inxml))); $xml=simplexml_load_file("messages.xml") or die("Error: Cannot create object"); $outhtml='
'; foreach($xml->children() as $note) { $outhtml=str_replace('', ' messages/note