/** * {@inheritDoc} */ public function postProcessValueHash($outgoingValueHash) { $document = new DOMDocument(); $document->loadXML($outgoingValueHash['xml']); $outgoingValueHash['xhtml5edit'] = $this->docbookToXhtml5EditConverter->convert($document)->saveXML(); return $outgoingValueHash; }
function convert($xmlString) { $inputDocument = $this->createDocument($xmlString); $this->removeComments($inputDocument); $convertedDocument = $this->converter->convert($inputDocument); // Needed by some disabled output escaping (eg. legacy ezxml paragraph <line/> elements) $convertedDocumentNormalized = new DOMDocument(); $convertedDocumentNormalized->loadXML($convertedDocument->saveXML()); $errors = $this->validator->validate($convertedDocument); $result = $convertedDocumentNormalized->saveXML(); if (!empty($errors)) { $this->logger->error("Validation errors when converting xmlstring", ['result' => $result, 'errors' => $errors, 'xmlString' => $xmlString]); } return $result; }
/** * Implements the "richtext_to_html5_edit" filter. * * @param \DOMDocument $xmlData * * @return string */ public function richTextToHtml5Edit($xmlData) { return $this->richTextEditConverter->convert($xmlData)->saveHTML(); }