Posts tagged "apostrophe"

Acrobat/Reader: Some special characters are not escaped in XML submission to a HTTP URL

Issue

If you are using XFA forms to submit/export data in XML format from Acrobat/Reader, you may notice that some of the special characters (<>”&’) are not being escaped in the XML output. This can lead to problems if this XML is then to be parsed server-side or used by custom applications.

Explanation

The XML data submitted/exported from Acrobat/Reader escapes characters like & (ampersand) > (greater than) and < (less than), but not ” (quote) or ‘ (apostrophe).  Custom applications may encounter problems when trying to parse XML data containing apostrophe or quote characters, if they are expecting these characters to be escaped like for <, > and &.

There are 5 predefined entity references in XML (http://www.w3schools.com/xml/xml_syntax.asp):

&lt;  < less than
&gt;  > greater than
&amp;  & ampersand
&apos;  ‘ apostrophe
&quot;  “ quotation mark

Note: Only the characters “<” and “&” are strictly illegal in XML. The greater than character is legal, but it is a good habit to replace it.

So the XML specification recommends to replace only “<“, “&” and “>”.  It does not require quote and apostrophe characters to be escaped for element values.  Therefore all conformant XML parsers should be able to handle this.

Quotes and apostrophes only need to be escaped if they occur in an attribute value surrounded by the same single or double-quote character.  In this case, Acrobat/Reader will escape the quote or apostrophe characters as required.

Notes:

You can use a regular button with script like “event.target.submitForm({cURL: url, cSubmitAs:”XML”});” to submit data in XML format to a specific URL.

reference: (182809204/3054499)

VN:F [1.9.22_1171]
Was this helpful? Please rate the content.
Rating: 6.3/10 (4 votes cast)