How can I embed a XML document inside a XHTML document?
Posted
by
Oriol
on Stack Overflow
See other posts from Stack Overflow
or by Oriol
Published on 2013-03-17T16:32:00Z
Indexed on
2013/11/02
3:54 UTC
Read the original article
Hit count: 126
For example, how can I embed
<?xml version="1.0" encoding="utf-8"?>
<root>
<node><![CDATA[Text]]></node>
</root>
in my XHTML?
I know I can put it in a CDATA section...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>My title</title>
</head>
<body>
<p>I am a XHTML paragraph!</p>
<div>
<![CDATA[
<?xml version="1.0" encoding="utf-8"?>
<root>
<node>Text</node>
</root>
]]>
</div>
</body>
</html>
... but then I have to remove XML file's CDATA sections and the XML is parsed as text instead of XML.
Then, I get this...
... but I want something like this:
© Stack Overflow or respective owner