473,770 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Special Character" Problem with DOM

I am using DOM to create an rss feed. The problem I am running into
is "special characters" such as é è ç. If I try adding them to the
XML as character data (CData), DOM chokes and throws out errors. If I
do a search and replace on the characters changing them to HTML
entities instead of using CDATA, DOM chokes up again. If I do a
combination of both (search and replace then add as Character Data) it
does not choke, but the RSS readers don't render the html entities
because they are defined as CDATA.

Any thoughts. I could write my own writer, but I would rather use
DOM.

Suggestions would be appreciated.

Thanks.

Diilbert

Jan 30 '07 #1
2 5582
On Jan 30, 11:15 am, "Diilb" <diilbert.atlan ...@gmail.comwr ote:
I am using DOM to create an rss feed. The problem I am running into
is "special characters" such as é è ç. If I try adding them to the
XML as character data (CData), DOM chokes and throws out errors. If I
do a search and replace on the characters changing them to HTML
entities instead of using CDATA, DOM chokes up again. If I do a
combination of both (search and replace then add as Character Data) it
does not choke, but the RSS readers don't render the html entities
because they are defined as CDATA.

Any thoughts. I could write my own writer, but I would rather use
DOM.

Suggestions would be appreciated.

Thanks.

Diilbert
If you want to add special characters like these as entities you'll
need to give the hex, numerical or unicode notation for that character
e.g.:
<!DOCTYPE example [
<!ENTITY copy "&#xA9;">
]>

(copied without shame from http://en.wikipedia.org/wiki/XML)

You can also check http://www.w3.org/TR/html401/sgml/entities.html and
http://www.w3.org/2003/entities/iso8879doc/isolat1.html for some more
reference material.

John

Jan 30 '07 #2
Thanks for the suggestion ;) I think this will fix my problem. But I
am trying to figure out how I am going to work this into my code since
I am loading data from a database. It could get "messy". Any ideas ?

I like to be as efficient as possible and there is nothing worse then
a mess. (At least to me anyway).

Thanks,

Diilb

On Jan 30, 1:05 am, "AussieJohn " <AussieJ...@gma il.comwrote:
On Jan 30, 11:15 am, "Diilb" <diilbert.atlan ...@gmail.comwr ote:
I am using DOM to create an rss feed. The problem I am running into
is "special characters" such as é è ç. If I try adding them to the
XML as character data (CData), DOM chokes and throws out errors. If I
do a search and replace on the characters changing them to HTML
entities instead of using CDATA, DOM chokes up again. If I do a
combination of both (search and replace then add as Character Data) it
does not choke, but the RSS readers don't render the html entities
because they are defined as CDATA.
Any thoughts. I could write my own writer, but I would rather use
DOM.
Suggestions would be appreciated.
Thanks.
DiilbertIf you want to add special characters like these as entities you'll
need to give the hex, numerical or unicode notation for that character
e.g.:
<!DOCTYPE example [
<!ENTITY copy "&#xA9;">
]>

(copied without shame fromhttp://en.wikipedia.or g/wiki/XML)

You can also checkhttp://www.w3.org/TR/html401/sgml/entities.htmlan dhttp://www.w3.org/2003/entities/iso8879doc/isolat1.htmlfor some more
reference material.

John
Jan 30 '07 #3

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

Similar topics

4
432
by: Norman Uhlenkott | last post by:
I would like to be able to put in special character inside an xml data string (#, <, >, &). when it trys to parses out the XML String it errors out strXML = "<?xml version='1.0'?>" & vbCRLF strXML = strXML + "<WO_Step>" & vbCRLF strXML = strXML + "<Test>Test Special Characters #, %, &, <, > </Test> strXML = strXML + "</WO_Step>"
0
897
by: Ray | last post by:
In vb.net response.write ("""haha""") this will return a "haha In c# the same code will return an error How do I correct the error in c# Actually, I have a stringbuilder and appending the <a href='#' onclick="window.open('/yaya/sali.aspx?images1/a1.jpg', 'garbage', 'width=800,height=600,top=100,toolbar=0,menubar=0,scrollbar=1,resizable=0')"><img src='/fala/imgd/a1.jpg' width=80px height=80px></a Please help
39
2422
by: TonyJeffs | last post by:
Great book - I like the way that unlike other books, AC++ explains as much as possible about every piece of code discussed, so I'm not left thinking, "well...OK... I get line 12, but I wonder what the rest of it means...". Still, I have some questions, that are frustrating me:- Grateful for any comments. 1. What is the difference between #include <iostream> // (or any include file) which is used in this
50
4356
by: The Bicycling Guitarist | last post by:
A browser conforming to HTML 4.0 is required to recognize &#number; notations. If I use XHTML 1.0 and charset UTF-8 though, does &eacute; have as much support as é ? Sometimes when I run the TIDY utility on my code, it replaces my character notations with weird looking things I don't recognize. Also, when I converted to UTF-8 from ISO-8859-1, I discovered many special characters
5
8715
by: Armand Karlsen | last post by:
On this page of my website: http://www.zen62775.zen.co.uk/rigs.html the W3C html validator claims that there are some bytes it cannot interpret in line 49 of the html source as UTF-8. If I force ISO-8859-1 encoding, however, the page will validate correctly but displays a warning about the & character on the same line, saying that & is the "first character of a delimiter but occurred as data". Is there any way to remedy this problem/issue?...
6
4165
by: Keith Smith | last post by:
How can I say "If e is equal to a printable character (as opposed to Insert, Del, Home, PageUp, PageDown, etc) then x=1"? Something like... if (e.KeyChar==PrintableCharacters) { x=1; }
1
1627
by: Kris | last post by:
Hi.. Why is it impossible to add a "&" character to item in VS2005 menustrip? In properties, it preserves itself as "&", but in menu, shows up as some small line instead of &. Can you help?
1
2725
by: DCC700 | last post by:
After upgrading a web application from VS 2003 to 2005 there is a page where any control event that should cause a postback instead generates an Invalid character error on the page. For example a drop down list is set to AutoPostBack, and for OnSelectedIndexChanged should update the values of other drop down lists. This page works fine in VS 2003, and the other pages with similar controls are posting back fine in 2005. Has anyone else...
6
1940
m6s
by: m6s | last post by:
I have a value saved in mysql table like this: {"name":"poppy"} When I need to place another symbol " for example to name it "Cheeps and Potatoes", it's saved in mysql table with \". Up to now all ok. This seems to me ok. Escape character added. I restore the value twice, now... Into a textfield in order to edit the value of name. And also as plain value in order to view it. As plain value, I can see the text "Cheaps and Potatoes" but...
0
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10257
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10037
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9904
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7456
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6710
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4007
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.