How to make REXML respect   (in 1.9)

P

Phlip

Rubies:

This fails on the second line...

REXML::Document.new('<b>&amp;</b>')
REXML::Document.new('<b>&nbsp;</b>')

....with Undeclared entity '&nbsp;'

If I make that real XHTML, with a DOCTYPE and a html xmlns="...xhtml", it
still fails.

I fixed the &nbsp; itself by adding [<!ENTITY nbsp " ">] to the DOCTYPE.
This seems extremely tacky, because it disregards all the other fun stuff in
XHTML.

(I suspect REXML with 1.8 did not have this issue.)

If I should call Entity.new('nbsp', ' '), I don't understand how to .add
that before the call to .new, and I don't understand how to easily add new
HTML content to a preexisting Document object.

Any tips?
 

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
473,780
Messages
2,569,611
Members
45,281
Latest member
Pedroaciny

Latest Threads

Top