Native XML Plugin: The document has no document element

I have a development site and a production site on the same server.

In the development site, I can import an XML file.

The same file that I imported in the Development site, I cannot import in the production site.

The only feedback is:

Validation errors:

  • The document has no document element.

There are no errors in the console log.

But in the error_log from PHP I got this:

[05-Mar-2018 11:38:12 Europe/Belgrade] PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in C:\inetpub\wwwroot\Newsletter\CEDEX\plugins\importexport\native\NativeImportExportPlugin.inc.php on line 133
[05-Mar-2018 11:38:12 Europe/Belgrade] PHP Notice: Trying to get property of non-object in C:\inetpub\wwwroot\Newsletter\CEDEX\plugins\importexport\native\NativeImportExportPlugin.inc.php on line 134
[05-Mar-2018 11:38:12 Europe/Belgrade] PHP Warning: DOMDocument::loadXML(): Empty string supplied as input in C:\inetpub\wwwroot\Newsletter\CEDEX\lib\pkp\classes\xslt\XMLTypeDescription.inc.php on line 120

In fact, i had copied the same native folder of the plugin, from the development site to the production site…

It is not a problem with the XML file, it works on the development site.
How can I debug this?

well it basically looks like the XML file is not uploaded successfully to the server.
The error is coming from here ojs/NativeImportExportPlugin.inc.php at ojs-stable-3_1_0 · pkp/ojs · GitHub

loadXML() is trying to use $xmlString, but the first error says it is empty. Meaning that the file_get_contents on row 131 has failed meaning that the $temporaryFilePath is probably empty.

Not sure what the solution here is. Is your whole files directory writable? Althought that is maybe not the place where XML files are stored. Is it possible that your server does not approve XML uploads? I dont know…

but i have the same server for both, the development and the production site.
Now that you mention it, the $temporaryFilePath is different from both.

I will check the permissions for the folder. Thanks!

I have this configuration in my config.inc.php
files_dir = "c:/xampp/htdocs/ojs/files"

That directory doesn´t exist.

you definitely need to create it. And if it is your production server, then the files directory should be outside the webroot so that it is not accessible directly. Meaning that you should not be able to access like http://yourserver.com/files

1 Like