Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Escaping characters in apex_util.download_print_document procedure

ciabigguy4youSep 23 2016 — edited Nov 4 2016

If the value I provide to the p_report_data parameter in the download_print_document procedure (https://docs.oracle.com/cd/E59726_01/doc.50/e39149/apex_util.htm#AEAPI150) includes special characters such as quotes or apostrophes, I receive the following error:

"XML document structures must start and end within the same entity."

Replacing the characters with xml escape strings such as ' and " results in the same error (presumably from the ampersand). The XML and its transform is perfectly valid when tested with my Cocoon print server in isolation. So the error is likely specific to how Oracle handles these characters.

So, what is the proper way to escape the special characters (', " , & and likely > and <) when passing data to download_print_document and similar procedures? That didn't appear to be documented.

Our agency is using Oracle DBMS 11.2, Application Express 5.0.2, tomcat 7.0.40, and a customized version of cocoon 2.1.11 fitted with fop-1.0.

But I don't the specific version matters. I've seen a similar issue with Application Express 4.2 and 4.1; Whenever I use an ampersand in a Report Layout stylesheet applied to a Report Query, I would get a similar error.

The solution for that was to include "select '&' from dual" as one of the Source Queries in the Report Query and substitute that value in the stylesheet. Now that I'm in a situation where I need to use my own custom XML instead of

a Report Query, I find that both source data and stylesheet are subject to special character mischief.

I appreciate any help that can be provided to help me resolve this issue. If I can pull it off, that would be quite the feather in my cap.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Dec 2 2016
Added on Sep 23 2016
2 comments
1,255 views