By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,320 Members | 2,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,320 IT Pros & Developers. It's quick & easy.

"Special Character" Problem with DOM

P: n/a
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
Share this Question
Share on Google+
2 Replies


P: n/a
On Jan 30, 11:15 am, "Diilb" <diilbert.atlan...@gmail.comwrote:
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

P: n/a
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...@gmail.comwrote:
On Jan 30, 11:15 am, "Diilb" <diilbert.atlan...@gmail.comwrote:
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.org/wiki/XML)

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

John
Jan 30 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.