CrossRef XML Export plugin not working in OJS 3

I am facing a problem in the plugin CrossRef XML Export plugin. When I am trying to register a DOI for a published article., an error appear to me:

.

The status the article still “Not Deposited”. I wish the help in solving this problem.

Hi @Abd_El-Nasser_Gharee

Could you please post that whole XML here?

Thanks!
Bozana



I failed to copy past the content of the error message that appeared to me so I capture it and send it as images. This message appear if i click on “submit” or “download XML” in the plugin.

I’m not seeing the specific case in the screenshots, but this is almost certainly an interaction of the disable_path_info setting with some missed XML entity encoding in the IssueCrossRefXmlFilter, specifically here:
https://github.com/pkp/ojs/blob/master/plugins/importexport/crossref/filter/IssueCrossrefXmlFilter.inc.php#L232

DOMDocument::createElementNS(), like DOMDocument::createElement() does not escape content. We should refactor any call which passes text content directly to either escape it, or create a real DOMText instance.

Edit: added Github Issue: DOMDocument::createElementNS() is being used without consideration for escaping · Issue #2074 · pkp/pkp-lib · GitHub

Hi @Abd_El-Nasser_Gharee and @ctgraham

I’ve just tested the changes from @ctgraham and they unfortunately only partly solve the problem here :frowning: The Crossref schema doesn’t allow square brackets in the resource element, so they are problem too :frowning: I do not now how to solve this, eventually only to ask Crossref to accept them too :slight_smile: Any other idea?

Thanks!
Bozana

Sorry, I was wrong, the urlencode does encode the squared brackets, but if applied to the whole URL it causes other problems:
Element '{http://www.crossref.org/schema/4.3.6}resource': [facet 'pattern'] The value 'http%3A%2F%2Flocalhost%2Findex.php%3Fjournal%3Dtest1%26page%3Dissue%26op%3Dview%26path%5B%5D%3Dissue1' is not accepted by the pattern '([hH][tT][tT][pP]|[hH][tT][tT][pP][sS]|[fF][tT][pP])://.*'.

Element '{http://www.crossref.org/schema/4.3.6}resource': 'http%3A%2F%2Flocalhost%2Findex.php%3Fjournal%3Dtest1%26page%3Dissue%26op%3Dview%26path%5B%5D%3Dissue1' is not a valid value of the atomic type '{http://www.crossref.org/schema/4.3.6}resource_t'.

Where is the urlencode() in the code?

nowhere now, but I thought it might be a solution…

Ah, this is my fault :-\ – The router url method does the escaping if the parameter is set, s. https://github.com/pkp/pkp-lib/blob/master/classes/core/PKPPageRouter.inc.php#L272 – so I will set that parameter to true for URLs…
Sorry!

@Abd_El-Nasser_Gharee

The issue is solved and you can find the patches in the current ojs-stable-3_0_1 branch:
For pkp-lib:

and

For ojs:

and

Best,
Bozana

Dear @bozana

I modified the php files as suggested without any success…I am still getting the same error messege.

Hi @Abd_El-Nasser_Gharee

Hmm… Did you apply/consider all 4 commits above?
Maybe you could also try to clear cache as admin, under Administration > Clear Data Caches and Clear Template Cache…
Having those changes should definitely display a different XML…

Best,
Bozana

Hi @bozana

I cleared the cache as admin without any changes in the error messege

And did you apply all these changes:

in lib/pkp:
https://github.com/pkp/pkp-lib/commit/6e555f5f0d43c53ab66538a60f9a3956c9e00560
https://github.com/pkp/pkp-lib/commit/6fc9fd1e98e30b03e0dcb2f5dee44e2294f2cd2e

in ojs:
https://github.com/pkp/ojs/commit/aefe07d4c850b8fed0619890191a33b5ace296fa
https://github.com/pkp/ojs/commit/dc35c4b2f294808d164c4e252abfe7e33ad2fa7a

?

Dear @bozana

I corrected the mentioned php files and I get an error messege differs from the first one

Validation errors:

Element '{http://www.crossref.org/schema/4.3.6}resource': 'http://www.m-sciences.com/index.php?journal=jast&page=article&op=view&path[]=1172' is not a valid value of the atomic type '{http://www.crossref.org/schema/4.3.6}resource_t'.

Element '{http://www.crossref.org/schema/4.3.6}resource': 'http://www.m-sciences.com/index.php?journal=jast&page=article&op=download&path[]=1172&path[]=967' is not a valid value of the atomic type '{http://www.crossref.org/schema/4.3.6}resource_t'.

Element '{http://www.crossref.org/schema/4.3.6}resource': 'http://www.m-sciences.com/index.php?journal=jast&page=article&op=download&path[]=1172&path[]=967' is not a valid value of the atomic type '{http://www.crossref.org/schema/4.3.6}resource_t'.
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"

Hi @Abd_El-Nasser_Gharee

Strange… it seems like the changes are not there – because the URL in the error message should be escaped now i.e. not contain $ and [ ] :frowning:
Could you please double check if these lines are changed on your installation:
ojs/IssueCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (all url functions should have true parameter at the end – this escapes [ ] )
ojs/IssueCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (htmlspecialchars is used to escape the value)
ojs/ArticleCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (url function with true parameter at the end – this escapes [ ] )
ojs/ArticleCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (url function with true parameter at the end – this escapes [ ] )
ojs/ArticleCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (url function with true parameter at the end – this escapes [ ] )
ojs/ArticleCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub (htmlspecialchars)

Thanks a lot!
Best,
Bozana

Dear @bozana

I revised the php according to your advice and I got the following notification:

Submission was not successful! The DOI registration server returned an error: '1 - HTTP/1.1 400 Bad Request

Content-Type: application/json
Vary: Accept
Access-Control-Allow-Origin: *
Access-Control-Allow-Headers: X-Requested-With
Content-Length: 270
Server: http-kit
Date: Tue, 13 Dec 2016 10:07:12 GMT
X-Rate-Limit-Limit: 50
X-Rate-Limit-Interval: 1s
Connection: close

[:status :failed][:message-type :entity-parsing-failure][:message {:exception “com.mongodb.MongoException$DuplicateKey: insertDocument :: caused by :: 11000 E11000 duplicate key error index: crossref.deposits.$id dup key: { : ObjectId(‘584fc8502d0e76564955b74f’) }”}]’.

Hi @Abd_El-Nasser_Gharee

Yes, currently there is something with Crossref deposit API – a lot of other users reported the same message in this forum – and Crossref is working on it. Thus, at the moment, till the problem is solved, the users can only download XML from OJS and upload it manually at the Crossref portal.

That means, you did finally manage to get/download a valid XML file?

Best,
Bozana

I am able now to download xml files and register a doi for each article through crossref website but i noticed that doi link redirect me to the page of the issue not the article page!! what is the reason?!!

Have you registered that DOI uploading the OJS XML file? What is the URL for that DOI in the XML file?