‎2016 Jul 07 2:43 PM
Greetings XML experts,
I am having an issue doing a simple transform (STRANS) in ABAP. I am having issues when some of the content of my elements contain special characters. ex:
<remarks>The sum of 8 is > 6, while 5 < 3</remarks>
<material>ABCD&1234</material>
The special characters <, &, > are not being recognized and causing an exception. Is there some XML command that allows the special characters? Something that I could add to my command ex:
<tt:cond>
<remarks tt:value-ref="zremarks"/>
</tt:cond>
<tt:cond>
<material tt:value-ref="zmaterial"/>
</tt:cond>
Thanks!
‎2016 Jul 07 2:59 PM
Hi Bill,
Since XML cannot handle special characters, you should use the escape characters.
So, element "&" should be replaced with "&". "<" (Less than) should be converted to "<" and ">" (Greater than) to ">".
Regards,
Felipe
‎2016 Jul 07 2:59 PM
Hi Bill,
Since XML cannot handle special characters, you should use the escape characters.
So, element "&" should be replaced with "&". "<" (Less than) should be converted to "<" and ">" (Greater than) to ">".
Regards,
Felipe
‎2016 Jul 07 3:05 PM
Felipe,
Thanks for the response. I changed my string to look for '&' and replace with '&', but this still fails during the simple transform. Any thoughts? Thanks.
‎2016 Jul 07 3:28 PM
You must replace with '&' (with a semicolon at the end; ignore the quotes) ; the worst character for the parser is '<' ; see Raymond answer.
‎2016 Jul 07 3:37 PM
‎2016 Jul 07 4:01 PM
Sandra,
I was able to use the & with success. I was missing the ' ; ' . thanks for the help with that. The < > is going to be a real pain I am guessing.
‎2016 Jul 07 3:12 PM
Replace every special characters with some xml/html entities:
Sample for some basic html entities, but google for list, depend also on languages in use...
REPLACE ALL OCCURRENCES OF '&' IN text WITH '&' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '"' IN text WITH '"' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '<' IN text WITH '<' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '>' IN text WITH '>,' IGNORING CASE.
REPLACE ALL OCCURRENCES OF '©' IN text WITH '©' IGNORING CASE.
Regards,
Raymond