โ06-03-2021 10:27 AM
Iโm having trouble using the XML Generator with data that contains special symbols and characters. All the usual suspects (<, >, &, ", ', ) have been taken care of by using the HTML notations <, >, &, etc., but Iโm having trouble with others that I feel should work. For instance, the symbol for the registered sign, ยฎ, should be notated as ยฎ, however, the XML generator gives me an error stating that โthe entity, reg, is referenced but not delcared.โ How do I go about declaring these. I have quite a number of symbols and accented/uumlatโed letters that I need to use. Whether I use the rendered symbol or the HTML notation, the XML Generator fails.
How can I successfully include these symbols in my XML messages so that the XML Generator doesnโt see them as errors? See pics below for examples of my issue.
โ06-03-2021 01:54 PM
I still need to investigate this. For the Formatter, do you check the โFormat as canonical XMLโ checkbox?
โ06-03-2021 02:18 PM
Hi, no I am not checking โFormat as canonical XML.โ I do check โStrict XSD Output.โ
โ06-03-2021 05:02 PM
Here are my results of testing entity reference escaping.
XML Generator (Escape Special Characters: unchecked)
Input: ®
Output: Registered Sign (decimal code point: 174, utf-8 hex bytes: C2 AE)
...
XML Formatter:
Input: Registered Sign
Output: Registered Sign
Running pipeline with โescapeโ checked.
XML Generator (Escape Special Characters: checked)
Input: ®
Output: &#174;
...
XML Formatter:
Input: ®
Output: &#174
As you know, if we try to use the ยฎ reference, XML Generator will fail with โSAXParseException The entity โregโ was referenced, but not declaredโ. However, if check โescape special charsโ, I get this.
XML Generator (Escape Special Characters: checked)
Input: ®
Output: &reg;
...
XML Formatter:
Input: ®
Output: &reg;
Admittedly, the escaping and transformations are a bit tricky in spots. I assume you would like to see ®
or ®
output from the XML Formatter? I can attach my sample pipeline after updating wsdl endpoint if helpful. Where is it failing for you and what you would like to see.
โ06-03-2021 07:54 PM
Hi Matthew
Yes, your results matched what Iโm experiencing too.
Ideally, I would like to see ®, ®, and ® go into the XML Generator (with Escape Special Characters unchecked) and come out in the exact same format, the same way as <, >, ', and " do. The same goes for the XML FormatterโฆI want to see any input that has been pre-escaped come out in the same format as it went in. This would make the behavior of the snaps consistent for all escaped codes.
As a retailer, our vendors pass to us product descriptions that are HTML formatted and friendly. I am attempting to place these product descriptions in XML messages so that they can be imported into our Salesforce hosted website and mobile app. Aside from <, >, ', ", and ยฎ, I have around 17-20 additional escape codes that I need to use, however, the way the XML Generator and Formatters are working now, I am unable to do this.
Can I request for a future release that these snaps be changed so that the behavior is consistent for all escape codes when the Escape Special Characters option is turned off, or how would I go about making a custom snap to behave this way? Without a change like this, Iโm pretty much dead in the water.
Thanks, Alex
p.s. Answering your question, where is it failing for me?
When I use ® as input to either the Generator or the Formatter, they both fail due to โregโ not being declared.
When I use ® and ®, they go through the Generator snap successfully, however, as youโve experienced, they come out of Generator snap as the registered sign. Downstream, when I am running this data through the XML Formatter (in preparation to do a file write), the Formatter fails because it does not like the registered sign.
I cannot use the Escape Special Characters option because I have so many codes that I need to use and this option only accounts for the less than sign, the greater than sign, the apostrophe, and quotation marks. No other symbols or special characters are recognized by this option.
โ06-04-2021 05:20 PM
Sorry. Got caught up with another issue today. I will reply on Monday (6/7). Have a nice weekend.