Hi,
I need to contain some html tag, which is the body of an html email, in a
xml file. I would use XML simple to retrieve the content of the xml file.
If it is not quoted properly, the xml file cannot be read by xml simple. How
should i quote the message with html tag?
Thanks
If xml simple uses an xml parser, I would just put it into a CDATA element.
That way you won't have to escape the html. But I don't know what simple
does on special elements like CDATA, xml decl's, etc..
You could always just use an xml parser directly to capture the
contents of CDATA.
CDATA is not html so you won't have to worry about nesting.
Something like below.
-sln
-----------------------
************************
xml file:
<?xml version="1.0" encoding="utf-8"?>
<doc>
<![CDATA[
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Dear Valued Customer, </TITLE>
<STYLE>
<!--
@page { size: 8.5in 11in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
P { margin-bottom: 0.08in; direction: ltr; color: #000000; widows: 2; orphans: 2 }
P.western { font-family: "Times New Roman", serif; font-size: 12pt; so-language: en-US }
P.cjk { font-family: "Times New Roman", serif; font-size: 12pt }
P.ctl { font-family: "Times New Roman", serif; font-size: 12pt; so-language: ar-SA }
A:link { color: #0000ff }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" DIR="LTR">
</BODY>
</HTML>
]]>
</doc>
************************
parsed xml:
______________________________
xmldecl_h _: version = 1.0
encoding = utf-8
--------------------
char _:
--------------------
start _: doc
--------------------
char _:
--------------------
cdata _:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
<TITLE>Dear Valued Customer, </TITLE>
<STYLE>
<!--
@page { size: 8.5in 11in; margin-right: 1.25in; margin-top: 1in; margin-bottom: 1in }
P { margin-bottom: 0.08in; direction: ltr; color: #000000; widows: 2; orphans: 2 }
P.western { font-family: "Times New Roman", serif; font-size: 12pt; so-language: en-US }
P.cjk { font-family: "Times New Roman", serif; font-size: 12pt }
P.ctl { font-family: "Times New Roman", serif; font-size: 12pt; so-language: ar-SA }
A:link { color: #0000ff }
-->
</STYLE>
</HEAD>
<BODY LANG="en-US" TEXT="#000000" LINK="#0000ff" DIR="LTR">
</BODY>
</HTML>