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><abc>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
Comment #2
jayanth commentedComment #3
ritzz commentedWorking on it.
Comment #4
ritzz commentedAdded condition. Kindly review.
Comment #5
broonThanks for already providing a patch. It's missing the setting of
$bool, though, thuswill always fail.
Comment #6
jayanth commentedYa, as i mentioned we should assign.
$bool = $domFragment->appendXML(self::html_entities_normalize_xml($r['html']));
Comment #7
flutterstack commentedcreated new patch.
Comment #8
flutterstack commentedComment #9
flutterstack commentedComment #10
flutterstack commentedAfter 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).
Comment #11
broonRegarding 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.
Comment #12
broonI've just committed a new patch to dev version that should get rid of the errors. Can you try that version with your patch?
Comment #14
broonPatch 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.
Comment #15
jayanth commented#11 Then, in that case, we should escapse " before processing.
Comment #17
broon