AJAX and non-xml entities


#1

Recently I made some changes so that I am serving up XHTML 1.1. I’m
talking about real XHTML where the mime type is changed to application/
xhtml+xml and firefox raises hell when there are errors rather then
trying to work around it.

I have a page that uses AJAX to update a div in the page, and I ran
into a problem that I didn’t have when serving using the text/html
mime type. The content that was passed back from the AJAX request
contained the “nbsp” html entity and firefox raised an error saying
that “nbsp” is not a valid xml entity.

So my question is how many other html entities are not valid when
passed as xml, and how do I properly send AJAXed content that contains
any such entity?


#2

I forgot to ask, is there anyway have the server include a dtd or
xmlns tag within the xml response to AJAX requests so that this
doesn’t cause problems? If not, shouldn’t rails be automatically
converting entities like this to something that is xml compatable like
“& # 1 6 0 ;”


#3

2007/4/11, removed_email_address@domain.invalid removed_email_address@domain.invalid:

<…> So my question is how many other html entities are not valid when

passed as xml, and how do I properly send AJAXed content that contains
any such entity?

I will not count how many are not valid, but only these firve are safe:
& ' < > "

Regards,
Rimantas

http://rimantas.com/