XML : JSP Multiple CDATA Sections when I need 1

I am generating XML inside JSP page in which I am using a CDATA section. The problem is the single CDATA section is converter into multiple CDATAs. Here is my code:

  <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><?xml   version="1.0" encoding="UTF-8"?>  <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>  <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>  <%@ page contentType="text/xml;charset=UTF-8" language="java" %>  <rss xmlns:content="http://purl.org/rss/1.0/modules/content/">      <channel>          <title>My Website</title>          <link>http://www.mywebsite.zz/</link>          <description>              Sample description          </description>          <language>en-us</language>          <item>                  <title>${item.title}</title>                  <link>${storyLink}</link>                  <guid isPermaLink="true">${storyLink}</guid>                  <pubDate><fmt:formatDate type="both"                          timeZone="UTC"                          pattern="yyyy-MM-dd'T'HH:mm:ssz"                          dateStyle="short" timeStyle="short"                          value="${item.createdTime}" />                  </pubDate>                  <description>                      ${item.description}                  </description>                  <content:encoded>                      <![CDATA[                         <!doctype html>                            <html lang="en" prefix="op: http://media.facebook.com/op#">                            <head>                                <meta charset="utf-8">                                <link rel="canonical" href="${storyLink}">                                <meta property="op:markup_version" content="v1.0">                         <body>                                <article>                                  <header>                                      <h1>${item.title}</h1>                                  </header>                                  ${item.post}                                </article>                         </body>                     ]]>                  </content:encoded>                </item>      </channel>  </rss>    

Here is the response I get:

  <rss xmlns:content="http://purl.org/rss/1.0/modules/content/">    <channel>    <title>Carbonated</title>    <link>http://www.mywebsite.zz/</link>    <description>Sample description</description>    <language>en-us</language>      <item>        <title>          My Title        </title>        <link>          http://localhost/mypost        </link>        <guid isPermaLink="true">          http://localhost/mypost        </guid>        <pubDate>2016-04-06T10:51:48UTC</pubDate>        <description>          This is a description        </description>        <content:encoded>          <![CDATA[            <!doctype html>            <html lang="en" prefix="op: http://media.facebook.com/op#">            <head>              <meta charset="utf-8">              <link rel="canonical" href="ht          ]]>          <![CDATA[              tp://localhost/mypost">              <meta property="op:markup_version" content="v1.0">            </head>          <body>            <article>              <header>                <h1>Heading</h1>              </header>              <p>topic post</p>            </article>          </body>        ]]>      </content:encoded>    </item>    

see that the single CDATA section is converted into multiple sections. I don't want this to happen.

No comments:

Post a Comment