Native XML Plugin > Export issues: (error) Could not convert issues


When trying to export an issue with the Native XML Plugin I get the message “Could not convert issues.”. I’m using OJS

First I searched the forum and as one post mentioned, I changed strftime from using %F to using %Y-%m-%d in plugins/importexport/native/filter/ but to no effect - I’m in linux and this should be working from the start with %F.

I know there’s something wrong with the XML output, but not exactly what.

The error I get in the console is:

2017/03/27 10:45:05 [error] 7440#7440: *28254 FastCGI sent in stderr: “PHP message: PHP Warning: DOMDocument::schemaValidate(): Internal error: xmlSchemaVDocWalk, there is at least one entity reference in the node-tree currently being validated. Processing of entities with this XML Schema processor is not supported (yet). Please substitute entities before validation… in /home/build_vascularc/www/lib/pkp/classes/xslt/ on line 126
PHP message: ojs2: Could not convert issues” while reading response header from upstream, client: 0:0:0:0, server:, request: “POST /index.php/vc/management/importexport/plugin/NativeImportExportPlugin/exportIssues HTTP/1.1”, upstream: “fastcgi://”, host: “”, referrer: “

So I went in /home/build_vascularc/www/lib/pkp/classes/xslt/ and commented out line 126 in order to get the XML output regardless if it’s valid or not.

// if (!$xmlDom->schemaValidate($this->_validationSource)) return false;

Now when exporting an issue, the error log doesn’t show anything obviously and I get my file. But it’s not schema validated. The file contents of the unvalidated issue export XML file may be found here

Can someone help with pointing out what’s wrong with the output file or -less likely- the schema?

Thank you!


Hi @Alex_Protopopescu,

If it’s an option, I’d suggest upgrading to OJS 3.0.2 – a lot of import/export fixes went into that release. I’m not sure it’ll solve your issue but it’s likely.

Alec Smecher
Public Knowledge Project Team

HI @asmecher,

That’s not an option right now, but I managed a workaround. Since the XML parser is bothered by HTML named entities that aren’t defined in the XML spec (all of them except the quot, amp, apos, lt, gt), all that’s needed is to convert all named entities to number entities before loading the import XML file for the first time, and then overwrite the file with the corrected content for future use by other scripts.

So if there’s anyone else that can’t momentarily upgrade from OJS or if this issue isn’t fixed in the next version (don’t know yet), then put the following code in file /home/build_vascularc/www/plugins/importexport/native/ right after line 129 ( $xmlString = file_get_contents($temporaryFilePath); ):

function htmlentities_named_to_ord($string){
return preg_replace_callback(’/&([a-zA-Z][a-zA-Z0-9]+);/’, ‘named_to_ord’, $string);
function named_to_ord($matches){
foreach($matches as $match)
return ‘&#’.ord(html_entity_decode($match)).’;’;
$xmlString = htmlentities_named_to_ord($xmlString);
file_put_contents($temporaryFilePath, $xmlString);

That’s all! Thank you!

Hi @Alex_Protopopescu

I have the same problem as you.
When I try to export an XML file I see a Could not convert issues error.
I tried your solution and after line 129 I put your code. Unfortunately, after that, I see only the white page in import / export on the site.

Could you help me solve this problem? I know that a lot of time has passed, but I must create XML and I can not update my system now.

Maybe you could provide me with the edited file for viewing?


Hello @lewiatan1989,

Indeed this was a long while ago. My workaround was specifically for OJS and consisted of two steps as detailed in the previous posts in this topic:

  1. Disabling the schema validation, so that the plugin will return some XML, even if schema invalid.
    Comment out the line containing
    if (!$xmlDom->schemaValidate($this->_validationSource)) return false;
    around line 126 in the file lib/pkp/classes/xslt/

  2. Replace HTML entities in the output XML:
    Add the following code

function htmlentities_named_to_ord($string){
  return preg_replace_callback('/\&([a-zA-Z][a-zA-Z0-9]+);/', 'named_to_ord', $string);
function named_to_ord($matches){
        foreach($matches as $match)
                return '&#'.ord(html_entity_decode($match)).';';
$xmlString = htmlentities_named_to_ord($xmlString);

Around line 129 in file plugins/importexport/native/ between the lines $xmlString = file_get_contents($temporaryFilePath); and $document = new DOMDocument();

Your mileage may vary, so watch your logs, also check out the resulting XML file in $temporaryFilePath and see if its contents are correct as far as the import format goes and there are no other XML parsing errors (check with an external XML parser). After all issues are fixed with this XML file, you may try to import it again.

Be sure to backup your SQL database, you will need to restore it a few times after messing with it during the import process!