From: "Zachary P. Landau" Date: 2004-02-05T13:48:47+09:00 Subject: Re: Creating mixed content elements in REXML --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Feb 05, 2004 at 09:40:02AM +0900, Francis Hwang wrote: > Say I have a string that represents an XML element that I want to > embed into a REXML::Element, how would I do this? >=20 > For example, if I have: >=20 > xhtml_elt =3D REXML::Element.new( 'xhtml' ) > xhtml_string =3D "

foo bar

" >=20 > Is there a way I could get to: >=20 > puts xhtml_elt.to_s > =3D>

foo bar

I'm no expert, but after looking at the REXML source, I don't think this is possible without changing the REXML code itself. I tried:" xhtml_elt =3D REXML::Element.new('xhtml', nil, {:raw=3D>:all}) xhtml_elt.text =3D '

foo bar

" but the second line raises an Illegal character '<' in raw string blah blah blah. There don't seem to be any options to avoid this. You probably don't want to do this, but you could have the string parsed and the correct REXML elements can be created. Sorry I couldn't help more. -- Zachary P. Landau GPG: gpg --recv-key 0x24E5AD99 | http://kapheine.hypa.net/kapheine.asc --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) iD8DBQFAIcq7CwWyMCTlrZkRAnsHAJ46vyb6cpCg/BijdtwWz9TB+3CULQCfX9lp DKUtVzwsM1wRtq81dxNgRwA= =8P37 -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--