Forum Moderators: coopster
Many Document Types based on XML need a mandatory xmlns="" on the root element. For example, the root element for XHTML will look like:
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
This line is contained inside my php script so the double forward slashes are causing the rest of the line to appear as a comment
Please can someone explain how I can stop this? I'm very new to PHP and working with code that's already written. I've managed to do most other things that I want but this has had me stumped for a while now.
I've read about escaping special characters and attempted to do this using a backslash after the semi-colon but it doesn't work.
any help is much appreciated.
The code I am working with reads:
$str .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$str .= "<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">";
$str .= "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
$str .= "<html xmlns="http:\"//www.w3.org/1999/xhtml" xml:lang="en" lang="en">\"";