From: TAKAHASHI Masayoshi Date: 2001-11-16T11:24:00+09:00 Subject: [ruby-talk:25373] Re: ANN: REXML 1.1a3 "James Britt (rubydev)" wrote: > Quote characters are fine, so long as there is no ambiguity when used inside an attribute value. > # Evil > > This is mal-formed because that second apostrophe indicates the end of the attribute value. Then comes some more text that doesn't > parse well. > # OK > > Changing the quote style works, but you may not always know, or control, how an XML builder will quote your attribute data. So, you > have to watch for this, too: > # Ow! In addition, when we use them as text, it's no problem. Ain't it cool! Give me an "A"! > It's not the characters themselves that are a problem, it's the context. I think so too. > Having REXML automagicaly convert these to their entity references helps avoid these sorts of conflicts. We have some options. a) "'" and '"' are automatically converted entity reference always. b) "'" and '"' are converted if it's attribute's value. c) Attribute object has @quote_mark variable which character use in serializing, and "'" and '"' are converted when @quote_mark uses same character. d) XMLWriter object has @quote_mark variable which character use in writing, and "'" and '"' are converted when @quote_mark uses same character. Regards, TAKAHASHI Masayoshi (maki@inac.co.jp)