[OJS] | Native XML - Import Errors

Describe the issue or problem

We have tried to upload with both the OJS interface, and with commands in the command line. After both methods, on the surface, issue galleys were not shown. Errors were not reported in the interface, but were reported in the log when using command line (see picture attached below). We have also tried to import with exported XML files from older issues already imported previously, and on a new OJS installation. The same errors were seen.

Here is a list of things we have tried, which consistently produced the same results:
In our production installation

  1. Import new XML file
  2. Import new XML file without galleys
  3. Export an older issue with Native XML, re-import the file

In a brand new OJS installation

  1. Import new XML file
  2. Import new XML file without galleys

Steps I took leading up to the issue
With OJS interface

  1. Login with User/Role ‘Journal Manager’
  2. Navigate to ‘Tools’ then ‘Native XML Plugin’ for import
  3. Upload your XML file
  4. Import

With command line

  1. In ‘tools’ folder of the journal
  2. use command: php importExport.php NativeImportExportPlugin import <xml_file_path> <journal_path> <user_name>

What application are you using?
OJS 3.3.0.20

Additional information
When importing using the interface, no error was reported and the import was shown as successful. However galleys for the issue are not showing.

When importing using command line, an exception was reported multiple times: (also see attached image)
Exception: Filter output validation failed, expected “classes.publication.Publication”, but found “array” in /var/www/html/lib/pkp/classes/filter/Filter.inc.php:459\nStack trace:\n#0 /var/www/html/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(185): …

Results were consistent when attempting to import an XML file of previous issues exported from Native XML itself. We have attempted on a fresh OJS installation and the same issues remained.

Hi @c.ho, what version of OJS was the XML file you are trying to import into 3.3. generated by? The Native XML format changes with each major version; for example, you can not import an XML file generated with 3.2 into a 3.3 install without editing the XML. Here’s a sample of the XML format expected for 3.3 for reference.

Thanks for the reply.
The file was generated for 3.3. Previously before the latest update to 3.3.0.20, the version was 3.3.0.16 though the same error showed up.
The XML file was also validated against the XSD files that came with 3.3.0.20.

Do you have other suggestions for things we can check?

Hi @c.ho, thanks for your patience - I was able to reproduce the issue you had using our sample data (with an added issue galley), and found it did not import the issue galley in 3.3 (but did work correctly in 3.4). I’ll look into this further and try to find a solution, but it may take some time as our team is busy preparing for our upcoming 3.5 release.

I’m afraid that I don’t have an answer for you, but I’m experiencing the same error. At least, the error messages I’m seeing on the command line when I try to import the XML match those in your screenshot.

I’m not sure if issue galleys are a concern here. When I grep the XML for issue_galleys the results are just a bunch of lines like

<issue_galleys xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pkp.sfu.ca native.xsd"/>

For what it’s worth, the XML was exported from OJS 3.3.0.21, and I am attempting to import it into a fresh instance running the same version. I’ve validated all the XML against the schema.

The issues seem to import correctly, but the volume of error messages is a bit concerning.

@c.ho You can apply a patch to make the galley import work.

In your OJS folder download the patch and apply it.

wget https://github.com/defstat/ojs/commit/17fb9d7821d1d49676844fafcd6ebfb6148bb504.patch
git apply --check 17fb9d7821d1d49676844fafcd6ebfb6148bb504.patch
git apply 17fb9d7821d1d49676844fafcd6ebfb6148bb504.patch

Related commit: pkp/pkp-lib#11107 Fix issueGalley import · defstat/ojs@17fb9d7 · GitHub

Hi all,

we also have 3.3.0.21 and we have the same problem.

we have applied the patch that you suggested, but unfortunately we have the same issue:

Filter output validation failed, expected “lib.pkp.classes.submission.SubmissionFile”, but found “array” in /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php:459)

Is there something that we need to add, in order to import issues successfully with the native plugin?

Dear @rslonik , @mbtuckersimm , @c.ho , @kaitlin

have you solved this issue?

Is there an available fix to be installed?

I’m with 3.3.0-21, I’m lost, don’t know how to fix it.

The imports were successful for us, despite the error messages. We imported everything and then upgraded to 3.4.

Thank you @mbtuckersimm

We could not see anything imported, just the error messages. We have exported two issues with their articles from a journal to another one, in the same installation, but without success.

Can you please tell us how to validate the XML? Is there a specific command?

The command I used was

xmllint --noout --schema /path/to/schema/native.xsd /path/to/exported-file.xml

I downloaded the schema files from the PKP github repos. There are three of them; the main file is

plugins/importexport/native/native.xsd

That one includes another .xsd file, which itself includes another one, and the include paths are assuming you have the entire OJS codebase sitting around. I edited the include paths in those files so it was all self-contained (that is, assuming all the schema files were in the same directory, not assuming the directory structure of the full OJS codebase).

Hope that’s helpful.

Thank you.

It validates. That means that the XML is correct.

Unfortunately nothing is imported when I try the import in OJS 3.3.0-21.

Anyone found a solution?

@joelfan what is the origin of your XML? I mean, what is the version of OJS that you are using to generate this XML files?

What is the command you are using to export and import the XMLs?

I’m not sure if this will help, but we imported the XML using the command-line tool, not the GUI. You can see the documentation for that here:

https://docs.pkp.sfu.ca/admin-guide/3.3/en/data-import-and-export#use-importexport-plugins-from-the-command-line

We still saw all the error messages, but the data was imported into the database and the pdfs were unpacked from the XML.

The origin is another journal in the same OJS, which is 3.3.0-21. We exported an issue via native XML plugin from a journal, and we tried to import the XML into a test journal. Without success.

@joelfan have you tried viu UI or command line, if command line can you share exact commands you are using? Can you share an example XML file?

We have not yet tried via command line.

You can find an exported file here. It was produced from an installation of OJS 3.3.0-21.

Thank you Rafael and Mbtucker, your help is so appreciated.

Now we also tried via command line.

The output is the following.



Exception: Filter output validation failed, expected “lib.pkp.classes.submission.SubmissionFile”, but found “array” in /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php:459
Stack trace:
#0 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(170): Filter->execute(Object(DOMDocument))
#1 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(128): NativeXmlSubmissionFilter->parseSubmissionFile(Object(DOMElement), Object(Submission))
#2 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(91): NativeXmlSubmissionFilter->handleChildElement(Object(DOMElement), Object(Submission))
#3 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeImportFilter.inc.php(60): NativeXmlSubmissionFilter->handleElement(Object(DOMElement))
#4 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlArticleFilter.inc.php(52): NativeImportFilter->process(Object(DOMDocument))
#5 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeXmlArticleFilter->process(Object(DOMDocument))
#6 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(260): Filter->execute(Object(DOMDocument))
#7 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(238): NativeXmlIssueFilter->parseArticle(Object(DOMElement), Object(Issue))
#8 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(134): NativeXmlIssueFilter->parseArticles(Object(DOMElement), Object(Issue))
#9 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(90): NativeXmlIssueFilter->handleChildElement(Object(DOMElement), Object(Issue), false)
#10 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeImportFilter.inc.php(60): NativeXmlIssueFilter->handleElement(Object(DOMElement))
#11 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeImportFilter->process(Object(DOMDocument))
#12 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(313): Filter->execute(Object(DOMDocument))
#13 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(404): NativeImportExportPlugin->importSubmissions(Object(DOMDocument), ‘native-xml=>iss…’, Object(NativeImportExportDeployment))
#14 /var/www/html/ojstest/tools/importExport.php(63): NativeImportExportPlugin->executeCLI(‘tools/importExp…’, Array)
#15 /var/www/html/ojstest/tools/importExport.php(69): importExport->execute()
#16 {main}
Exception: Filter output validation failed, expected “classes.publication.Publication”, but found “array” in /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php:459
Stack trace:
#0 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(185): Filter->execute(Object(DOMDocument))
#1 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(131): NativeXmlSubmissionFilter->parsePublication(Object(DOMElement), Object(Submission))
#2 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeXmlSubmissionFilter.inc.php(91): NativeXmlSubmissionFilter->handleChildElement(Object(DOMElement), Object(Submission))
#3 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeImportFilter.inc.php(60): NativeXmlSubmissionFilter->handleElement(Object(DOMElement))
#4 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlArticleFilter.inc.php(52): NativeImportFilter->process(Object(DOMDocument))
#5 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeXmlArticleFilter->process(Object(DOMDocument))
#6 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(260): Filter->execute(Object(DOMDocument))
#7 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(238): NativeXmlIssueFilter->parseArticle(Object(DOMElement), Object(Issue))
#8 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(134): NativeXmlIssueFilter->parseArticles(Object(DOMElement), Object(Issue))
#9 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(90): NativeXmlIssueFilter->handleChildElement(Object(DOMElement), Object(Issue), false)
#10 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeImportFilter.inc.php(60): NativeXmlIssueFilter->handleElement(Object(DOMElement))
#11 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeImportFilter->process(Object(DOMDocument))
#12 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(313): Filter->execute(Object(DOMDocument))
#13 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(404): NativeImportExportPlugin->importSubmissions(Object(DOMDocument), ‘native-xml=>iss…’, Object(NativeImportExportDeployment))
#14 /var/www/html/ojstest/tools/importExport.php(63): NativeImportExportPlugin->executeCLI(‘tools/importExp…’, Array)
#15 /var/www/html/ojstest/tools/importExport.php(69): importExport->execute()
#16 {main}
PHP Fatal error:  Uncaught Error: Call to a member function getData() on null in /var/www/html/ojstest/classes/search/ArticleSearchIndex.inc.php:38
Stack trace:
#0 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlArticleFilter.inc.php(61): ArticleSearchIndex->submissionMetadataChanged(Object(Submission))
#1 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeXmlArticleFilter->process(Object(DOMDocument))
#2 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(260): Filter->execute(Object(DOMDocument))
#3 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(238): NativeXmlIssueFilter->parseArticle(Object(DOMElement), Object(Issue))
#4 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(134): NativeXmlIssueFilter->parseArticles(Object(DOMElement), Object(Issue))
#5 /var/www/html/ojstest/plugins/importexport/native/filter/NativeXmlIssueFilter.inc.php(90): NativeXmlIssueFilter->handleChildElement(Object(DOMElement), Object(Issue), false)
#6 /var/www/html/ojstest/lib/pkp/plugins/importexport/native/filter/NativeImportFilter.inc.php(60): NativeXmlIssueFilter->handleElement(Object(DOMElement))
#7 /var/www/html/ojstest/lib/pkp/classes/filter/Filter.inc.php(449): NativeImportFilter->process(Object(DOMDocument))
#8 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(313): Filter->execute(Object(DOMDocument))
#9 /var/www/html/ojstest/plugins/importexport/native/NativeImportExportPlugin.inc.php(404): NativeImportExportPlugin->importSubmissions(Object(DOMDocument), ‘native-xml=>iss…’, Object(NativeImportExportDeployment))
#10 /var/www/html/ojstest/tools/importExport.php(63): NativeImportExportPlugin->executeCLI(‘tools/importExp…’, Array)
#11 /var/www/html/ojstest/tools/importExport.php(69): importExport->execute()
#12 {main}
thrown in /var/www/html/ojstest/classes/search/ArticleSearchIndex.inc.php on line 38

@joelfan I managed to import the content. This error is misleading. You can safely ignore it.

You do not need the patch because the patch will deal with IssueGalleys and this XML you sent me does not seem to have those.

These below are the actual errors I got at the end of importing:

Errors occured:
1.Submission

Unknown genre Articolo
2.Submission

Unknown genre Articolo

Unknown genre Articolo

I’m not sure if you are getting those if you have your OJS in Italian. Mine is in english, so I had to restore the database, create an “Articolo” component at Workflow > Submission > Components and try again.

Now the import worked (all those verbose exceptions continue but no “Errors occured:” at the end).

However, it broke my OJS. The cause is that my OJS being in english it does not have “Autore” user groups.

$ grep "<author user_group" ~/native-20260212-155622-issues-46.xml
<author user_group_ref="Autore" seq="7" id="42194">
<author user_group_ref="Autore" seq="5" id="41961">

I changed to Author:

sed ‘s/Autore/Author/g’ ~/native-20260212-155622-issues-46.xml > ~/native-fixed.xml

And this made the importing finally work. I imported using:

php -d memory_limit=512M importExport.php NativeImportExportPlugin import ~/native-fixed.xml tj myadminuser

Not sure if you’ll need this part, but in my notes on a past work I had to Export/Import Native XML I had to export Authors and then Import:

# Export users from install
php -d memory_limit=512M importExport.php UserImportExportPlugin export ~/xml/users.xml myjournal
# Import
php -d memory_limit=512M importExport.php UserImportExportPlugin import ~/xml/users.xml myjournal myadminuser

Good luck! Attached are some images showing that the content was import successfully.

Thank you so much. It works.

I really appreciate your help!