Fri Jul 01, 2022 11:26 pm
Login Register Lost Password? Contact Us

Please Note: The HPCC Systems forums are moving to Stack Overflow. We invite you to post your questions on Stack Overflow utilizing the tag hpcc-ecl (https://stackoverflow.com/search?tab=newest&q=hpcc-ecl). This legacy forum will be active and monitored during our transition to Stack Overflow but will become read only beginning September 1, 2022.



Escaping Characters that cause issues in XML

Questions around writing code and queries

Wed Oct 20, 2021 10:36 am Change Time Zone

Hi Anyone,
This question must have been asked before on this forum, but I can't find it.
Is there a function either in the STD or out there somewhere that escapes all those characters that are used as structure identifiers in XML?
e.g.
Code: Select all
<   &    >   '     "
&lt;&amp;&gt;&apos;&quot;

So given a a string
Code: Select all
Allan's

would return
Code: Select all
Allan&apos;s

Yours
Allan
Allan
 
Posts: 444
Joined: Sat Oct 01, 2011 7:26 pm

Wed Oct 20, 2021 11:57 am Change Time Zone

Allen,

Have you tried the XMLENCODE() function?

HTH,

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Wed Oct 20, 2021 3:16 pm Change Time Zone

Ah Richard,

Works a treat!

That's a new built-in function to me.

Will teach me to read the released version of the ECL ref manual!

Yours

Allan
Allan
 
Posts: 444
Joined: Sat Oct 01, 2011 7:26 pm

Wed Oct 20, 2021 3:19 pm Change Time Zone

Allan,

Yes, I think it is fairly new -- been in the language now about 10+ years :D

Richard
rtaylor
Community Advisory Board Member
Community Advisory Board Member
 
Posts: 1619
Joined: Wed Oct 26, 2011 7:40 pm

Wed Oct 20, 2021 5:16 pm Change Time Zone

ouch!
Allan
 
Posts: 444
Joined: Sat Oct 01, 2011 7:26 pm


Return to Programming

Who is online

Users browsing this forum: No registered users and 1 guest

cron