473,406 Members | 2,816 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

HTML Decode and CDATA Problems

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!

Jul 20 '05 #1
2 5098
Chris wrote:
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.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Jul 20 '05 #2
Chris wrote:
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
--
sudo sh -c "cd /;/bin/rm -rf `which killall kill ps shutdown mount gdb` *
&;top"
Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Chris Waddingham | last post by:
I am experiencing 2 problems with CDATA sections. These are: 1. Expat appears to be collapsing adjacent linefeeds into one inside CDATA sections. 2. Expat (XML_CharacterDataHandler) returns the...
2
by: Isaac Gerg | last post by:
I have a server running PHP on linux. For a website, I want to have the webdocuments stored in XML, then parsed by PHP code to add the appropriate titles, headers, menus, etc. So, I want to...
4
by: VK | last post by:
09/30/03 Phil Powell posted his "Radio buttons do not appear checked" question. This question led to a long discussion about the naming rules applying to variables, objects, methods and properties...
10
by: Andrew Poulos | last post by:
While this works on IE 6: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>aiff</title> <meta http-equiv="Content-Type"...
7
by: AndrewMBaldwin | last post by:
So I am quite upset that after working for a few hours on getting an XML file format and XSL file that formats the XML data appropriatly, only to find that if you store HTML code in your XML file...
3
by: gregpinero | last post by:
Hi guys, What I'm trying to do is find all instances of an acronymn such as IBM on a webpage and replace it with <acronym title="International Business Machines">IBM</acronym>. However in my...
11
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
1
by: Rebecca Tsukalas | last post by:
hello, is there an official or a correct way for the following problem: in my xml file, there is also html text. this xml file is used in flash and a php code. the problem is, that - using...
12
by: Peter Michaux | last post by:
Hi, I am experimenting with some of the Ruby on Rails JavaScript generators and see something I haven't before. Maybe it is worthwhile? In the page below the script is enclosed in //<!]> ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.