Thu Dec 02, 2021 6:39 am
Login Register Lost Password? Contact Us


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: 442
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: 1606
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: 442
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: 1606
Joined: Wed Oct 26, 2011 7:40 pm

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

ouch!
Allan
 
Posts: 442
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