HTML Decode and CDATA Problems

C

Chris

Wondering if anyone can help me...

I have a text node that has been HTML encoded. The text is has CDATA
tags around it. The problem is I can't seem to decode the text. When
the CDATA is gone, I can decode it fine. When it's not HTML encoded,
then obviously I won't have to decode it. But when it's encoded and has
CDATA tags I can't seem to do anything with it! I can't change the XML
so can anyone think of a way I can work with this text to decode it
properly? Basically, I need to un-CDATA the text before I can apply the
decode template.

Thanks so much!
 
D

David Dorward

Chris said:
I have a text node that has been HTML encoded. The text is has CDATA
tags around it.

So either the author intended for it to be HTML source and not HTML, or
someone make a boo-boo.
can anyone think of a way I can work with this text to decode it
properly? Basically, I need to un-CDATA the text before I can apply the
decode template.

Write a preprocessor to strip out the CDATA markers on that element. It
shouldn't be hard with a regexp or two.
 
P

Peter Flynn

Chris said:
Wondering if anyone can help me...

I have a text node that has been HTML encoded. The text is has CDATA
tags around it. The problem is I can't seem to decode the text. When
the CDATA is gone, I can decode it fine. When it's not HTML encoded,
then obviously I won't have to decode it. But when it's encoded and has
CDATA tags I can't seem to do anything with it! I can't change the XML
so can anyone think of a way I can work with this text to decode it
properly? Basically, I need to un-CDATA the text before I can apply the
decode template.

FAQ: http://xml.silmaril.ie/authors/cdata/

///Peter
 

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

Members online

Forum statistics

Threads
474,001
Messages
2,570,249
Members
46,846
Latest member
BettinaOsw

Latest Threads

Top