Hi,
I have written the following content in my text view

<abc>Guideline

When i switch to Code view in ckeditor it is changed to

<p>&lt;abc&gt;Guideline</p>

Note: "Guideline" is a taxonomy term.

After I save and open the article, the article is not showing the line I written. And there is warning in logs, saying

"Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : Premature end of data in tag abc"

This is understandable because as i have not given end tag for , the module throwing warning and completely removed the line.
In such situations, it is better to render the line as is. I meant even without highlighting glossary term.

===
Just a side note: In case we feel to render as it is if warnings are thrown,

We can fix this by checking whether appendXML is successful or not,
$bool = $domFragment->appendXML(self::html_entities_normalize_xml($r['html']));
if($bool){
     $r['dom']->parentNode->replaceChild($domFragment, $r['dom']);  
}

Comments

jayanth created an issue. See original summary.

jayanth’s picture

Issue summary: View changes
ritzz’s picture

Assigned: Unassigned » ritzz

Working on it.

ritzz’s picture

Status: Active » Needs review
StatusFileSize
new696 bytes

Added condition. Kindly review.

broon’s picture

Status: Needs review » Needs work

Thanks for already providing a patch. It's missing the setting of $bool, though, thus

if($bool){

will always fail.

jayanth’s picture

Ya, as i mentioned we should assign.
$bool = $domFragment->appendXML(self::html_entities_normalize_xml($r['html']));

flutterstack’s picture

StatusFileSize
new831 bytes

created new patch.

flutterstack’s picture

Status: Needs work » Needs review
flutterstack’s picture

StatusFileSize
new833 bytes
flutterstack’s picture

Status: Needs review » Needs work

After applying patch #9 I am getting below warnings. we need to work on this.

Warning: DOMDocumentFragment::appendXML(): ^ in Drupal\onomasticon\Plugin\Filter\FilterOnomasticon->process() (line 104 of modules/contrib/onomasticon/src/Plugin/Filter/FilterOnomasticon.php).

Warning: DOMDocumentFragment::appendXML(): s be used instead.">Package = AND Work Item Type = Story in Drupal\onomasticon\Plugin\Filter\FilterOnomasticon->process() (line 104 of modules/contrib/onomasticon/src/Plugin/Filter/FilterOnomasticon.php).

Warning: DOMDocumentFragment::appendXML(): Entity: line 1: parser error : chunk is not well balanced in Drupal\onomasticon\Plugin\Filter\FilterOnomasticon->process() (line 104 of modules/contrib/onomasticon/src/Plugin/Filter/FilterOnomasticon.php).

Warning: DOMDocumentFragment::appendXML(): s be used instead.">Package = AND Work Item Type = Story in Drupal\onomasticon\Plugin\Filter\FilterOnomasticon->process() (line 104 of modules/contrib/onomasticon/src/Plugin/Filter/FilterOnomasticon.php).
Warning: DOMDocumentFragment::appendXML(): dule State = In-Progress AND Blocked =Yes AND Iteration = in Drupal\onomasticon\Plugin\Filter\FilterOnomasticon->process() (line 104 of modules/contrib/onomasticon/src/Plugin/Filter/FilterOnomasticon.php).

broon’s picture

Regarding the error messages, what settings are you using with Onomasticon filter? This looks like you are using "Title attribute" as implementation method which may cause such errors if double quotes are part of the term description.

broon’s picture

I've just committed a new patch to dev version that should get rid of the errors. Can you try that version with your patch?

broon’s picture

Status: Needs work » Fixed

Patch is in the dev version, now, thanks for providing a patch. I'll mark the issue as fixed.

However, I feel it's not satisfying as the actual term doesn't get the description now since no replacement takes place due to the XML error. But I fail to see a way around that right now. If anyone can come up with a solution for those cases, feel free to reopen the issue.

jayanth’s picture

#11 Then, in that case, we should escapse " before processing.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

broon’s picture

Assigned: ritzz » Unassigned