How can I post HTML on an XML Post?

Discussion in 'XML & RSS' started by Dave Gold, Aug 17, 2006.

  1. #1
    I am having the hardest time getting Atom API to accept my HTML code. Here is an example of my php:

    	$content = "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>\r\n"
       . "<entry xmlns='http://purl.org/atom/ns#'>\r\n"
       . "<title mode='escaped' type='text/plain'>".$title."</title>\r\n"
       . "<issued>".$issued."</issued>\r\n"
       . "<generator url='http://www.yoursitesurlhere.com'>Your client's name
    here.</generator>\r\n"
       . "<content type='application/xhtml+xml'><div xmlns='http://www.w3.org/1999/xhtml'>$body</div>"
       . "</content>\r\n"
       . "</entry>\r\n";
    Code (markup):

    Ok as you can see, $body is my HTML that I am posting. A lot of times when I have links in there, it fails to post. I don't know how to convert this. I tried putting a CDATA in there. I tried changing the < to &lt; but then it shows up not as HTML code on the blog post. How can I actually make it post as HTML? Oh yeah I also tried "mode=encoded" or something I read about on the content type tag, but that didn't help either. I will be so grateful if anyone knows this!
     
    Dave Gold, Aug 17, 2006 IP