OJS3.0.2 and Crossref Plugin validation error

Hi,

Edit: same thing with 3.0.2.

I am testing CrossRef plugin in OJS 3.0.2.

I get these errors when trying to submit or load an XML file

Opening and ending tag mismatch: p line 246 and body
Opening and ending tag mismatch: body line 3 and html
Premature end of data in tag html line 2
Failed to parse the XML resource 'http://www.crossref.org/schema/deposit/crossref4.3.6.xsd'.

The XML, which is printed in the bottom, is valid, I checked it with CrossRef.

I especially do not understand the line 246 part while there are not that many lines?

I have this in my error log

[Fri Feb 03 17:35:00 2017] [error] [client 192.168.175.24] PHP Warning: htmlspecialchars(): charset `UTF=8’ not supported, assuming utf-8 in public_html/plugins/importexport/crossref/filter/IssueCrossrefXmlFilter.inc.php on line 113, referer: /management/importexport/plugin/CrossRefExportPlugin
[Fri Feb 03 17:35:01 2017] [error] [client 192.168.175.24] PHP Warning: DOMDocument::schemaValidate(): Invalid Schema in /public_html/lib/pkp/classes/xslt/XMLTypeDescription.inc.php on line 126, referer: /management/importexport/plugin/CrossRefExportPlugin
[Fri Feb 03 17:35:01 2017] [error] [client 192.168.175.24] ojs2: Valittuja kohteita ei voitu muuntaa., referer: management/importexport/plugin/CrossRefExportPlugin

Hi @ajnyga,

Try applying this patch: Correct UTF=8 typo in CrossRef issue export · Issue #2257 · pkp/pkp-lib · GitHub

Regards,
Alec Smecher
Public Knowledge Project Team

thanks, I already fixed that one myself. The main problem seems to be the schema validation part.

On line 126 the value given to $this->_validationSource is http://www.crossref.org/schema/deposit/crossref4.3.6.xsd

Should it be: https://data.crossref.org/schemas/crossref4.3.6.xsd

Yes @ajnyga, it seems that it changed, because earlier it was working… I will provide a fix for that soon…
Thanks for finding and reporting, as always :-)))
Edit: s. Crossref 4.3.6 schema URL changed · Issue #2258 · pkp/pkp-lib · GitHub

It is probably connected to their new website. They are probably doing a lot other changes there as well.

Hmm… there also seem to be a problem when validating against a remote schema, because non of them works at the moment (mEDRA, DataCite, Crossref) i.e. they all have the same validation error :frowning:

ok, commenting line 126 of course solves this and everything works after that.
I know way too little about the way the schema validation works to start solving that. Thank you in advance.

Ah, for testing reasons I disabled allow_url_fopen in php.ini which led to not working remote (‘http://…’) schemas… :stuck_out_tongue: With allow_url_fopen = On everything works fine and just the Crossref URL change has to be fixed…

So having allow_url_fopen = Off in config.inc.php will cause the validation to break? I think it is off by default so this is something that should be instructed for DOI users?

hmmm… no, this setting is ignored by schemaValidate function – it only matters if it is enabled in the php.ini.
I am not sure if there is any other possibility, except to disable validation in case this setting is “Off”.
And in any case the users should be somehow instructed…

Maybe an option to enable/disable validation would be a solution, s. [OJS] 3.0.0 schemaValidate, proxy settings and allow_url_fopen · Issue #1955 · pkp/pkp-lib · GitHub.
(Validation is very good to have before DOI registration, because it saves loops of questions…)

Dear staff

I have changed the http://www.crossref.org/schema/deposit/crossref4.3.6.xsd to https://data.crossref.org/schemas/crossref4.3.6.xsd according to Crossref 4.3.6 schema URL changed · Issue #2258 · pkp/pkp-lib · GitHub “Crossref 4.3.6 schema URL changed”, and corrected the "Correct UTF=8 typo in CrossRef issue export ",
I also have added “allow_url_fopen = On;” in the blank php.ini of ojs.

But the Crossref plugin still show
Validation errors:

Failed to locate the main schema resource at ‘http://www.crossref.org/schema/deposit/crossref4.3.6.xsd’.
Invalid XML:

<?xml version="1.0" encoding="utf-8"?>
<doi_batch xmlns="http://www.crossref.org/schema/4.3.6" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:jats="http://www.ncbi.nlm.nih.gov/JATS1" xmlns:ai="http://www.crossref.org/AccessIndicators.xsd" version="4.3.6" xsi:schemaLocation="http://www.crossref.org/schema/4.3.6 http://data.crossref.org/schemas/crossref4.3.6.xsd">
  <head>
...

Could not convert selected objects.

Do I miss anything to solve this validation error? Is it related to server setting? or the bug has not been solved until now?

Best regards

Hi @Buyi_Li

I don’t understand where did you add allow_url_fopen = On, but it is probably so, that your server php.ini does not allow it i.e. contains allow_url_fopen = Off so that the validation against a remotes schema is not possible. The validation function ignores the setting in the OJS config.inc.php.
You could either try to enable fopen on your server, or you could disable validation, export the XML and upload it manually in the Crossref portal.

Best,
Bozana

This error message indicates that schema validation is still being attempted against the www… url instead of the data… url.

In the patch at Crossref 4.3.6 schema URL changed · Issue #2258 · pkp/pkp-lib · GitHub there is not only a change for the definition in the XML file and PHP files, but also a change to a record in the database:

UPDATE filter_groups SET output_type = 'xml::schema(http://data.crossref.org/schemas/crossref4.3.6.xsd)' WHERE output_type = 'xml::schema(http://www.crossref.org/schema/deposit/crossref4.3.6.xsd)'

Did you manually make all of these changes?