1 Reply Latest reply on Jan 7, 2008 10:09 AM by JR "Bob" Dobbs-qSBHQ2

    CDATA / html to xml

    Level 7
      How do i take the content of an html file and put in in an xml.

      The part that's in the CDATA are now individual html files so I want to
      take
      the content of that html file and put it in the CDATA. I'm not sure if
      that's the best way to do it though... might be better to store the HTML in
      the DB and then write it out from there???


      <emailMessage>
      <messagetype>Welcome</MessageTpye>
      <Subject>Welcome</Subject>
      <MessageContent>
      <![CDATA[<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
      " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
      <html xmlns=" http://www.w3.org/1999/xhtml">
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
      <title>test</title>
      </head>
      <body>
      welcome to our site<br /> you are blah blah<br /><br />
      <p>blah blah</p>
      <table><tr><td>whatever</td></tr></table>
      </body>
      </html>
      ]]>
      </MessageContent>
      </emailMessage>

      The part that's in the CDATA are now individual html files so I want to
      take
      the content of that html file and put it in the CDATA. I'm not sure if
      that's the best way to do it though... might be better to store the HTML in
      the DB and then write it out from there???

      Suggestions?




        • 1. Re: CDATA / html to xml
          JR "Bob" Dobbs-qSBHQ2 Level 3
          It is possible that your HTML, if it attempts to conform to XHTML standard, could include a CDATA section and I don't think you're permitted to nest a CDATA section inside another CDATA section.

          quote:

          I'm not sure if that's the best way to do it though... might be better to store the HTML in the DB and then write it out from there???


          It depends on your goal. If you're creating a content management system using a database for storage is probably a better option.