× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi,

I trying to code a sed statement that I can run from RPG to translate
special entities that are killing my %XML_INTO operation.

Notably, the xml document is being delivered containing embedded &
characters.



Now sed is a very powerful tool that can do this easily, once you get
your propeller hat on.

I'm almost there, but no cigar.

For example, if my xml file named test1.xml contains the following -



<company>smith & brown not smith &amp; jones but F&P </company>



Note: the 2nd ampersand between smith and jones has already been
converted to the entity &amp; so we want to ignore this.

Just convert the ampersands between smith and brown plus others like the
one in F&P.



So far, when I run this from QShell

sed 's/\&[^amp]/\&amp;/g' test1.xml



I get

<person>smith &amp;brown not smith &amp; jones but F&amp; </person>



Note: when I get it right I'll redirect the result to a file instead of
stdout



It's replacing the ampersand OK but also the character after it, while
correctly ignoring the existing &amp;

So the space before brown has gone, likewise the P in F&P.



How to make this baby behave.



Cheers, Peter




Visit our website www.vedaadvantage.com. It has a new design with improved navigation and search capabilities; and customer friendly interface with more relevant insights and solutions to help you make informed decisions.

#####################################################################################

This correspondence is for the named person's use only. It may contain confidential
or legally privileged information, or both. No confidentiality or privilege is waived
or lost by any mistransmission. If you receive this correspondence in error, please
immediately delete it from your system and notify the sender. You must not disclose,
copy or rely on any part of this correspondence if you are not the intended recipient.
Any views expressed in this message are those of the individual sender, except where
the sender expressly, and with authority, states them to be the views of Veda Advantage.
If you need assistance, please contact Veda Advantage on either :-
Australia 1300-921-621 or New Zealand +64 9 367 6200

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.