On 11/04/2011 19:10, Rajpreet wrote:
Requirement goes like this. I have perl script reading from a MQ Series queue. This queue has messages in form of XML.For exmpale 1 message is like - <CLIENT_INFO> <LOCATION> New York </LOCATION> <FIELD> FINANCE GROUP </FIELD> <NO_OF_WORKERS> 123 </NO_OF_WORKERS> <CLIENT_INFO> My perl script reads messgaes from this queue, and drops them to another queue after creating a backup in a text file. My requirement is I have check the value of a particular tag for example, value of <FIELD>, if that is say "FINANCE GROUP", I have to change it to "FINANCIAL SYSTEMS" and then drop to the other queue. I tried below, but for some reason it did not work. COuld you please help.
This is a design issue. There is a specification mismatch and someone has made a decision to make things even worse. If your source is XML and bound to stay that way then the proper way to do things is to apply an XSLT transform to all <FINANCE GROUP> elements. You cannot do this properly in Perl because you cannot predict the contents of the element you are required to transform, and copying it verbatim is unlikely to succeed. IMO your senior needs a slap. Just make sure that, if you write a simple global s/<(\/?)FINANCE_GROUP>/<$1FINANCIAL_SYSTEMS>/g you expect it to go wrong. That is not XML. Rob -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/