Simon Krahnke
8/13/2007 9:51:00 PM
* Felix Windt <fwmailinglists@gmail.com> (22:18) schrieb:
> I'm leaving off the opening bracket '<':
>
> line.gsub!(/registrantName>/, 'SUB.HEAD4>')
>
> So that it will match the opening as well as closing statement.
As well as any substring "registrantName>". And well-formed XML won't
guarantee that only "<registrantName>" and "</registrantName>" will
contain that.
gsub!(/(<\/?)registrantName>/, '\1SUB.HEAD4>') should do.
But again, CDATA-sections and comments may well contain these strings.
I'd use XSLT or some SAX-Library if it has to be ruby.
mfg, simon .... l