Page 1 of 1
					
				Error "Could not insert document fragment" in Oxygen 25
				Posted: Tue May 30, 2023 2:01 pm
				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.")
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Tue May 30, 2023 2:09 pm
				by chrispitude
				Hi Martin,
Just curious - if you double-encode the ampersand, does it work?
 
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Tue May 30, 2023 2:25 pm
				by Martin de la Iglesia
				Yes, &cetera would produce the desired result and throws no error.
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Tue May 30, 2023 6:58 pm
				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.
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Wed May 31, 2023 7:58 am
				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
 
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Wed May 31, 2023 11:24 am
				by Martin de la Iglesia
				OK, thank you, Radu. I'm looking forward to that release then.
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Wed Jul 05, 2023 7:24 am
				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
 
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Wed Jul 05, 2023 11:11 am
				by Martin de la Iglesia
				Thank you, Radu. I can confirm that it works now once I set the parameter to 'false'.
			 
			
					
				Re: Error "Could not insert document fragment" in Oxygen 25
				Posted: Wed Jul 05, 2023 11:30 am
				by Radu
				Thanks for taking the time to test this, Martin!
Regards,
Radu