CDATA

G

Guest

I have the XML file content as

<resources>
<html><![CDATA[<B>Hello World</B>]]></html>
</resources>

and my html file content is

<html><![CDATA[<B>Hello World</B>]]></html>

the XML file when viewed doesnt give me any problem, but when it comes to
HTML the output that i recieve is

Hello World]]>

In order to remove the square bracket and the angle bracket in the HTML I
make the following correction:
HTML:
<html><![CDATA[<B>Hello World</B></html>
XML:
<resources>
<html><![CDATA[<B>Hello World</B></html>
</resources>

But now XML throws an error and HTML works fine.

Thanks for any help.
 
J

Joe Fawcett

I think this would be better posted in one of the XML groups.
How are you transforming to HTML from the XML? As far as I know HTML doesn't
really support CDATA sections and storing HTML within a CDATA section in XML
invariably leads to problems down the line.
 
G

Guest

Kumar.A.P.P said:
I have the XML file content as

<resources>
<html><![CDATA[<B>Hello World</B>]]></html>
</resources>

and my html file content is

<html><![CDATA[<B>Hello World</B>]]></html>

the XML file when viewed doesnt give me any problem, but when it comes to
HTML the output that i recieve is

Hello World]]>

In order to remove the square bracket and the angle bracket in the HTML I
make the following correction:
HTML:
<html><![CDATA[<B>Hello World</B></html>
XML:
<resources>
<html><![CDATA[<B>Hello World</B></html>
</resources>

But now XML throws an error and HTML works fine.

Thanks for any help.

You are mixing xhtml with html.

CDATA is only recognised in xhtml, so you have to add doctype and
namespace to the page to make it xhtml (or perhaps configure the server
to serve the file as text/xml).

The data that you put in the page is html (as it has upper case element
names), so you have to turn it into xhtml to work.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top