Error "Could not insert document fragment" in Oxygen 25

Having trouble installing Oxygen? Got a bug to report? Post it all here.
Martin de la Iglesia
Posts: 19
Joined: Tue Aug 22, 2017 5:43 pm

Error "Could not insert document fragment" in Oxygen 25

Post by Martin de la Iglesia »

I have configured an Author action that inserts content from another XML file using a XSLTOperation and the Replace action. This works fine up to including Oxygen Editor version 24. In v. 25 however, when this action is executed, I get the error message "Could not insert document fragment. Cause: The entity name must immediately follow the '&' in the entity reference" when there is an & in the text node to be inserted. (When the ampersand in the source document is followed by a letter, e.g. "&cetera" (&cetera) the error message reads: "Could not insert document fragment. Cause: The reference to entity 'cetera' must end with the ';' delimiter.")
chrispitude
Posts: 907
Joined: Thu May 02, 2019 2:32 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by chrispitude »

Hi Martin,

Just curious - if you double-encode the ampersand, does it work?

Code: Select all

&cetera
Martin de la Iglesia
Posts: 19
Joined: Tue Aug 22, 2017 5:43 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Martin de la Iglesia »

Yes, &cetera would produce the desired result and throws no error.
Martin de la Iglesia
Posts: 19
Joined: Tue Aug 22, 2017 5:43 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Martin de la Iglesia »

Of course, double-encoding the ampersands or otherwise altering the source XML document is not a feasible solution to this problem.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Radu »

Hi Martin,
Thanks for the report, this report is similar to:
viewtopic.php?p=70662#p70662
Sorry for the inconvenience, I will try to add a new parameter to the XSLTOperation to control this behavior Oxygen has when it comes to interpreting entity references in the next Oxygen 25.1 minor bug fix release, probably in about a month. I will update this forum thread when a fix is available.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Martin de la Iglesia
Posts: 19
Joined: Tue Aug 22, 2017 5:43 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Martin de la Iglesia »

OK, thank you, Radu. I'm looking forward to that release then.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Radu »

Hi,
We made a minor Oxygen 25.1 bug fix release which adds a parameter to control this behavior:
https://www.oxygenxml.com/build_history.html#2023070306
Author: Added a new parameter named escapeEntityRefs to the TransformOperation Author operation to control if entity references are escaped as plain text in the processed content.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Martin de la Iglesia
Posts: 19
Joined: Tue Aug 22, 2017 5:43 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Martin de la Iglesia »

Thank you, Radu. I can confirm that it works now once I set the parameter to 'false'.
Radu
Posts: 9059
Joined: Fri Jul 09, 2004 5:18 pm

Re: Error "Could not insert document fragment" in Oxygen 25

Post by Radu »

Thanks for taking the time to test this, Martin!
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply