[OJS 3.1.2-1] PubMed OtherAbstract tag

Hi all:

I’m trying to add an adicional abstract in Spanish with OtherAbstract tag but It breaks.

The lines what I trying to add are:

$spanishAbstract = PKPString::html2text($publication->getLocalizedData(‘abstract’, ‘es_ES’);
$articleNode->appendChild($doc->createElement(‘OtherAbstract Language=‘es’’, $spanishAbstract ));

Regards,
Diego

Hi @madileweb,

Are you seeing unescaped characters causing problems in the XML? If so, the problem is the appendChild function; it does not escape the contents you give it. See the note on appendChild in the PHP documentation. I’d recommend using createTextNode instead.

Also, you’ll need to take the Language='es' out of the createElement call; use $element->setAttribute('Language', 'es') on the returned object.

Regards,
Alec Smecher
Public Knowledge Project Team

Hi @asmecher, thanks for solution. It works!

Regards,
Diego