Hi,
I am creating a simple function that takes some information and creates an xml file. Some of this information is html. I want to just take raw html and input it into xml. I don't want to try and convert the html into xml.
I am sure there are much better ways to create an xml document but can i do this with the method i am using?
<?
$title = 'xml test';
$url = 'http://xml_test.com';
$htmlcode = '<p><font face="Arial, Helvetica, sans-serif" size="-1">When audiences
first saw "2001" in the spring of 1968, & many were baffled. The film
lacked a traditional plot structure, contained almost no dialogue,
</FONT>';
$file= fopen("text.xml", "w");
$_xml ="<?xml version=\"1.0\" ?>\r\n";
$_xml .="\t\t<test>\r\n";
$_xml .= "\t\t<title>".$title."</title>\r\n";
$_xml .= "\t\t<url>".$url."</url>\r\n";
$_xml .= "\t\t<htmlcode>".$htmlcode."</htmlcode>\r\n";
$_xml .= "\t\t</test>\r\n";
fwrite($file, $_xml);
fclose($file);
echo "<p>XML has been written. <a href=\"rss.xml\">View the XML.</a></p>";
?>
So the problem is I need a valid xml file no matter what is inside <htmlcode> . The example above shows some of the crappy code that could be inputed. I can't convert any code. I need it to just blindly accept whats there.
Any help is appreciated.
Chuck