From: Rich Kilmer Date: 2001-11-16T04:52:25+09:00 Subject: [ruby-talk:25326] Re: ANN: REXML 1.1a3 (pre-encoded strings) > -----Original Message----- > From: Julian Fitzell [mailto:julian-ml@beta4.com] > Sent: Thursday, November 15, 2001 2:41 PM > To: ruby-talk ML > Subject: [ruby-talk:25325] Re: ANN: REXML 1.1a3 > > [ . . . ] > > Hmm... what if I want to actually include the text d ? I > admit it's not very common unless you are talking about XML > itself... but again this requires the user to know something > about the encoding, otherwise they may be surprised when that > part is not encoded... I wonder if it would be better to use a > different method if you want text not to be escaped? I'm not > sure myself so I'm just throwing the idea out there. > > Julian What about defining a module as a "tag" and then using the obj.extend(module) method to extend your String before passing it in. Module XMLEncoded end text = "you encode & as &" element.text = text.extend(XMLEncoded) then the text is not encoded if (text.kind_of? XMLEncoded)==true That way no further parameters need to be defined, just "type checking" and it could speed up the processing because its pre-encoded. -rich