Hi Richard, <![CDATA[ <html><tag><soup>here</soup></tag></html> ]]> I believe putting <![CDATA[ ]]> around the HTML will not work when using <DOCTYPE html> and it will also prevent the html from being parsed into nodes that can be access via the DOM APIs Or should the html that is inside the JS be urlencoded? <strong> This works but the only drawback is that we would have to decode it when we want to generate HTML inside the browser Many thanks for the feedback Best regards, __ Raymond Irving On Mon, Jun 7, 2010 at 4:45 AM, Richard Quadling <rquadling@xxxxxxxxx>wrote: > On 6 June 2010 19:56, Raymond Irving <xwisdom@xxxxxxxxx> wrote: > > Hello, > > > > Sorry to have to be writing to you directly. I've tried sending this > email > > to the mailing list but it keeps returning with a failure message: > > > > Remote host said: 550 5.7.1 reject mailfrom [sbl] > > > > It appears that my yahoo about has been black listed? > > > > Anyway, I'm hoping you can help me with the following issue: > > > > I'm getting a php warning from DOMDocument after running a test script > that > > tried to load some html inside the DOM and then echo the html to the > > browser: > > > > Warning: DOMDocument::loadHTML() [domdocument.loadhtml]: Unexpected end > tag > > : strong in Entity, line: 8 in C:\www\dom-test.php on line 23 > > > > The problem is that DOMDocument::loadHTML() attempts to remove the > > '</strong>' tag from within a JavaScript string variable inside the > > <script> tag. If I try to wrap <!-- --> around the content of the > <script> > > tag it will still throw the error. > > > > > > I've tested it with php *5.2.0, 5.2.6, 5.2.11*, *5.3* and *5.3.2*. It > > appears to work just fine in version 5.2.0 but the other version throw > the > > above error. > > > > Here's the script. Can anyone confirm this error or is there a known > > workaround? > > > > <?php > > > > $html = ' > > <!DOCTYPE html> > > <html> > > <head> > > <meta http-equiv="Content-Type" content="text/html; > charset=UTF-8"/> > > <script type="text/javascript"> > > var html = "<strong>Bold Text</strong>,Normal Text"; > > document.write(html); > > alert(html); > > </script> > > </head> > > <body> </body> > > </html> > > '; > > > > $dom = new DOMDocument(); > > $dom->loadHTML($html); > > > > echo $dom->saveHTML(); > > > > ?> > > > > > > Best regards > > __ > > Raymond Irving > > > > Or should the html that is inside the JS be urlencoded? > > <strong> > > ? > > -- > ----- > Richard Quadling > "Standing on the shoulders of some very clever giants!" > EE : http://www.experts-exchange.com/M_248814.html > EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > ZOPA : http://uk.zopa.com/member/RQuadling >