Invalid characters in XML writeln statements
Hint Ref: 020911170013
Hint Date: 17/11/2009
Hint Details:
ISSUE:
When using '<Writeln>' within an XML script, if you have characters such as '&' and '<' within it, the job will show a load error when trying to run.
RESOLUTION:
Here is a list of replacements to use instead of the characters (there should be no space following the '&' as there is here - this is just to ensure they display rather than are interpreted).
& amp; refers to an ampersand (&)
& lt; refers to a less-than symbol (<)
& gt; refers to a greater-than symbol (>)
& quot; refers to a double-quote mark (")
& apos; refers to an apostrophe (')
EXAMPLE
The code of:
<Writeln>We& apos;d like to inform you...</Writeln>
would show:
We'd like to inform you...
RESOLUTION 2
In some cases it is easier to treat the text as a block, particularly where there are a large number of problem characters. In this case, surround the text with the following codes: '<![CDATA[' and ']]>'
EXAMPLE 2
<Writeln><![CDATA[We'd like to inform you of a special option which entitles you to a free M&S voucher worth £5 ...]]></Writeln>
(Please Note: This Procedure can be destructive and should only be used by Advanced Users. RADical Systems (UK) Limited or its Partners cannot be held responsible, in anyway, for any consequence of using this or any other Database Function, Procedure or SQL command. Responsibility resides solely with the user.
IT IS HIGHLY RECOMMENDED THAT A FULL AND VALID SPACE MANAGER DATABASE BACKUP IS TAKEN AND VERIFIED AS VALID BEFORE MAKING ANY CHANGES TO THE DATABASE.)