tag:help-archives.hannonhill.com,2010-02-09:/discussions/bug-reports/2559-some-characters-escaped-in-xml-others-notCascade CMS: Discussion 2015-05-18T15:53:27Ztag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-03-30T17:38:47Z2015-03-30T17:38:47Zsome characters escaped in xml, others not?<div><p>Hi Lauren,</p>
<p>Can you tell me how you are outputting the value you pasted for
the XML? For example, is this coming from an XSLT Format or is it
from a Velocity Format?</p>
<p>The <a href="http://www.w3.org/TR/xml/#syntax">XML syntax</a>
requires that the following characters always be escaped:<br></p>
<pre>
<code>&
<
>
"
'</code>
</pre>
So, if the data you entered into a text field is being indexed by
an Index Block, for example, the Index Block must escape the entire
field to make sure that the Block is valid XML. I believe an XSLT
Format would also automatically escape the entire value here
because XSL must contain valid XML as well.</div>Timtag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-03-31T10:08:11Z2015-04-01T13:47:54Zsome characters escaped in xml, others not?<div><p>Hi Tim,<br>
I don't have a format applied, just the default xml template:</p>
<pre>
<code><xml>
<system-region name= "DEFAULT" />
</xml></code>
</pre>
<p>The data is currently just being entered into a data definition,
that is applied to a page (we're using web services to update the
page).</p>
<p>Is there a simple "default" velocity (or xslt) format that could
be applied to all configuration sets?</p></div>lauren.frasertag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-04-01T14:47:29Z2015-04-01T14:47:29Zsome characters escaped in xml, others not?<div><p>Gotcha. In that case that is going to be the expected
outcome.</p>
<blockquote>
<p>Is there a simple "default" velocity (or xslt) format that could
be applied to all configuration sets?</p>
</blockquote>
<p>Not that I'm aware of. What would you be looking for this
particular Format to do?</p></div>Timtag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-04-01T18:41:33Z2015-04-01T18:41:33Zsome characters escaped in xml, others not?<div><p>Tim,</p>
<p>We have a txt file that we export out of our credentialing
software and we’re going to use it to feed the new provider
pages on our redesigned site via web services.</p>
<p>We tried using bricks to match the providers areas of interest
with links to our health content (so a cardiologist with a
treadmill stress test as an area of interest would link to a page
with info about treadmill stress testing), but we had too many
distinct links that needed to be built.</p>
<p>Ryan suggested using external links and an index block, which is
doable, but we wondered about the time/tax of going through over
+350 links to find the 25 or less that match for a specific
provider. We have an area we can store the links in and export it
to our software. I could pull the area of interest text and the
link separately, then combine them in the page format, but I was
hoping to avoid that and just pass the needed html code to the data
def.</p>
<p>I had tested with one area and used a replace function in
velocity to convert the escaped characters back to < , >,
&, etc. and was able to get it to work. But when I added the
complete set for my test provider, the html showed differently
(some characters escaped, some not) and I get this error
message:</p>
<p>An error occurred: Could not transform with Script format
"_internal/formats/providers/provider-listing-links": Error on line
76: The reference to entity "isArticleLink" must end with the ';'
delimiter.</p>
<p>You may choose to retry the operation <a>javascript:location.reload(false)</a>
. If the problem persists, please contact a system
administrator.</p>
<p>The error has been logged to the system console.</p>
<p>Here is the xml link sample:</p>
<p><a href ="<a href="http://citizensmemorial.adam.com/content.aspx?productId=117&isArticleLink=false&pid=60&gid=000759"%3EEvaluation">http://citizensmemorial.adam.com/content.aspx?productId=117&amp;isA...</a>
& treatment of cardiovascular disease</a></p>
<p>And a link to the xml file we’re reading:</p>
<p><a href="https://www.citizensmemorial.com/Temp/providerWebDataLinks.xml">https://www.citizensmemorial.com/Temp/providerWebDataLinks.xml</a></p>
<p>Which doesn’t have the characters escaped in it.</p>
<p>Thanks,</p>
<p>Lauren</p></div>lauren.frasertag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-04-01T21:07:16Z2015-04-01T21:07:16Zsome characters escaped in xml, others not?<div><p>Hey Lauren,</p>
<p>Thanks for the additional information.</p>
<p>The error you mentioned:<br></p>
<pre>
<code>An error occurred: Could not transform with Script format "_internal/formats/providers/provider-listing-links": Error on line 76: The reference to entity "isArticleLink" must end with the ';' delimiter.</code>
</pre>
is because the ampersand wasn't being escaped properly.
<blockquote>
<p><a href="https://www.citizensmemorial.com/Temp/providerWebDataLinks.xml">https://www.citizensmemorial.com/Temp/providerWebDataLinks.xml</a>
Which doesn’t have the characters escaped in it.</p>
</blockquote>
<p>That link does appear to have the characters escaped in it. It
may just be the browser you are using to view it. For example, if
you're using Firefox, viewing the XML will show unescaped
characters but if you actually view the source code of the frame
containing the XML, you'll see escaped characters. For
example:<br></p>
<pre>
<code><PROVIDER_AREAS_OF_INTEREST_USERDEF_M12>&lt;a href="http://citizensmemorial.adam.com/content.aspx?productId=117&amp;isArticleLink=false&amp;pid=1&amp;gid=002323"&gt;Evaluation &amp; treatment of peripheral arterial disease (PAD)&lt;/a&gt;</PROVIDER_AREAS_OF_INTEREST_USERDEF_M12></code>
</pre></div>Timtag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-04-02T10:11:36Z2015-04-02T10:11:36Zsome characters escaped in xml, others not?<div><p>This is the velocity I tried using for the area of interest:</p>
<p>$_SerializerTool.serialize($docInterest1,
true).replaceAll(">", ">").replaceAll("<",
"<").replaceAll("&", "&")<br></p>
<p>I just saw that the & in the link is being outputted as
&amp; inside of Cascade.</p>
<p>I changed my velocity to the following and it worked:</p>
<p>$_SerializerTool.serialize($docInterest1,
true).replaceAll(">", ">").replaceAll("<",
"<").replaceAll("&amp;", "&")<br></p>
<p>So my only question – is will this always output the same
way? It seems weird that it is escaping the & from the original
escaped &</p>
<p>But not the & in > or <.</p>
<p>Thanks,</p>
<p>Lauren</p></div>lauren.frasertag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-05-12T18:41:13Z2015-05-12T18:41:13Zsome characters escaped in xml, others not?<div><p>Hi Lauren,</p>
<p>Our apologies for not responding sooner to your discussion.</p>
<blockquote>
<p>So my only question – is will this always output the same
way? It seems weird that it is escaping the & from the original
escaped &</p>
</blockquote>
<p>It sounds to me as though serializing the content may be causing
the <code>&amp;</code> to be double-encoded, which would
explain why your adjustment is working. Based on what you have, you
should be OK since the code will only replace double-encoded
ampersands. For example, if your content ends up containing
<code>&</code>, the serializer would turn that into
<code>&amp;</code>, which won't be replaced and shouldn't throw
an error since it's valid.</p>
<p>Please let me know if you have any questions.</p>
<p>Thanks!</p></div>Ryan Griffithtag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-05-18T15:01:54Z2015-05-18T15:01:54Zsome characters escaped in xml, others not?<div><p>Ryan,</p>
<p>Thanks for following up. It looks like the code we have in place
now is working. At this point, I can’t remember if we tested
the EscapeTool or not. But it’s working reliably, so
we’ll go ahead and stick with it.</p>
<p>Lauren</p></div>lauren.frasertag:help-archives.hannonhill.com,2010-02-09:Comment/364266282015-05-18T15:53:26Z2015-05-18T15:53:26Zsome characters escaped in xml, others not?<div><p>Thank you for following up, Lauren. We are glad to hear your
updates are doing the trick.</p>
<p>I'm going to go ahead and close this discussion, please feel
free to comment or reply to re-open if you have any additional
questions.</p>
<p>Have a great day!</p></div>Ryan Griffith