Normalizing XML tag values

Hi all,

I am looking for some piece of Ruby code that normalizes XML attribute
values (i.e., replaces '<' with '&@60;', etc).

I need it for this project: http://rubyforge.org/projects/test-report/,
and I am sure that somebody has already invented this particular bicycle
in Ruby.

Best regards,
Alex

I am looking for some piece of Ruby code that normalizes XML attribute
values (i.e., replaces '<' with '&@60;', etc).

I'm not sure what &@60; is. Is this what you mean?

irb(main):001:0> require 'rexml/text'
=> true
irb(main):002:0> REXML::Text.normalize '<foo & bar>'
=> "&lt;foo &amp; bar&gt;"

Best regards,
Alex

Sam

···

On Mon, 2 Aug 2004 04:25:19 +0900, Alexey Verkhovsky <alex@verk.info> wrote:

I'm not sure what &@60; is. Is this what you mean?

[snip]

> irb(main):002:0> REXML::Text.normalize '<foo & bar>'
> => "&lt;foo &amp; bar&gt;"

Yes, that's it. Thanks!

I mistakenly thought that rexml was only for parsing XML. Now I know
that it's also for writing :slight_smile:

Best regards,
Alex

···

On Sun, 2004-08-01 at 22:40, Sam Stephenson wrote: