CrossRef XML Export plugin not working in OJS 3

for this article:
http://www.m-sciences.com/index.php?journal=ijas&page=article&op=view&path[]=1116

the xml file contains the following links:

<resource>http://www.m-sciences.com/index.php?journal=ijas&amp;amp;page=article&amp;amp;op=view&amp;amp;path%5B%5D=1116</resource>

<item crawler="iParadigms">
          <resource>http://www.m-sciences.com/index.php?journal=ijas&amp;amp;page=article&amp;amp;op=download&amp;amp;path%5B%5D=1116&amp;amp;path%5B%5D=999</resource>
        </item>

<resource mime_type="application/pdf">http://www.m-sciences.com/index.php?journal=ijas&amp;amp;page=article&amp;amp;op=download&amp;amp;path%5B%5D=1116&amp;amp;path%5B%5D=999</resource>
1 Like

Ah, so sorry @Abd_El-Nasser_Gharee, this is my fault – the URLs are now double escaped (&amp;amp;) because I forgot to remove the htmlspecialchars function after using the escape parameter for the request url function :frowning: Here is the patch: pkp/pkp-lib#2074 remove double escape for Crossref URLs by bozana · Pull Request #1144 · pkp/ojs · GitHub
After applying those changes you will unfortunately have to download and register the XML again :frowning:
Sorry, sorry, sorry…

Thanks a lot!
Bozana

I modified it without any changes

Hi @Abd_El-Nasser_Gharee

Ah, yes, it seems to be another bug, the “&” in URL is not escaped properly :frowning: S. "&" in URL wrongly escaped and escaped "&" wrongly interpreted · Issue #2103 · pkp/pkp-lib · GitHub. I will let you know as soon it is solved…

Thanks!!!
Bozana

Hi @Abd_El-Nasser_Gharee

@ctgraham helped to find where is the problem. It seems that the XML that you have submitted to the Crossref still contains double encoding &amp;amp; i.e. it seems like you haven’t applied all changes :frowning:
Could you please double check this line of code, if it is the same as here: ojs/IssueCrossrefXmlFilter.inc.php at ojs-stable-3_0_1 · pkp/ojs · GitHub

Also, could you please post your XML here, to see if it is correct…

Best,
Bozana

Hi @bozana

This line in my system files written as:

$doiDataNode->appendChild($node = $doc->createElementNS($deployment->getNamespace(), 'resource', htmlspecialchars($url, ENT_COMPAT, 'UTF-8')));

This is according to the modification suggested by @asmecher

Hi @Abd_El-Nasser_Gharee/all,

I don’t recall suggesting any changes regarding this code…?

Regards,
Alec Smecher
Public Knowledge Project Team

@Abd_El-Nasser_Gharee,

Assuming the call to this consistently has the url’s escape parameter true, like:

You don’t want the call to htmlspecialchars() in this line.

On the other hand, @bozana, I think it makes more sense to defer any escaping of the URL until it is actually being written out to the XML. I would suggest reverting pkp/pkp-lib#2074 missing xml and url escape · pkp/ojs@dc35c4b · GitHub in favor of just escaping the data at the point of XML encoding - especially when it is being passed into subroutines like this.

@ctgraham, in that case, if we use htmspecialchars, the [ ] is not escaped, which trows validation error for Crossref :frowning: We could ask Crossref to change that, but it could take time. What would you suggest, to keep it then this way or to use htmspecialchars and additionally escape [ ] for Crossref?

Yep, if this is CrossRef’s problem, add a special bit of code in the CrossRef plugin to escape just the [] characters until they fix it.

@bozana, I just uploaded a document containing the <doi_data> resource <resource>http://jwsr.pitt.edu/ojs/index.php/jwsr/article/view/60?test[]=1&amp;test[]=2</resource> to Crossref’s metadata quality check without error.

I don’t see any reason why the square brackets would be disallowed in the resource_t definition in CrossRef’s Common 4.3.6 schema. Where did you originally encounter this issue? I see you reference it in this thread 10 days ago:

The Crossref schema doesn’t allow square brackets in the resource element, so they are problem too

Hmmm… I get the XML validation error with that URL:
Validation of current file using XML schema:
ERROR: Element '{http://www.crossref.org/schema/4.3.6}resource': 'http://jwsr.pitt.edu/ojs/index.php/jwsr/article/view/60?test[]=1&test[]=2' is not a valid value of the atomic type '{http://www.crossref.org/schema/4.3.6}resource_t'.
Could you validate it as it is?

Strange that that Crossref check does not complain :open_mouth: It seems, there are different validators… :stuck_out_tongue:

Maybe my PHP Schema Validator (and from my editor) are not working correct… But that would probably be the case for the others as well… Hmmm… Phew…

The issue with the Crossref deposit API is solved i.e. the “Register” button should work as earlier…

Dear @bozana
I have download my xml from ojs 3 for DOI register and I success uploading to crossref manually
But… I get this message from crossref.

<?xml version=“1.0” encoding=“UTF-8”?>
<doi_batch_diagnostic status=“completed” sp=“ds3.crossref.org”>
<submission_id>1433481708</submission_id>
<batch_id>_1539612838</batch_id>
<record_diagnostic status=“Failure”>
<doi>10.30598/indo. j. chem. res…v6i1.562</doi>
<msg>DOI: 10.30598/indo. j. chem. res…v6i1.562 , contains invalid characters</msg>
</record_diagnostic>
<batch_data>
<record_count>1</record_count>
<success_count>0</success_count>
<warning_count>0</warning_count>
<failure_count>1</failure_count>
</batch_data>
</doi_batch_diagnostic>

Could you help me please… Thank you

Hi @wayan_sutapa

It seems like your DOI syntax is incorrect. Crossref allows only these characters: “a-z”, “A-Z”, “0-9” and “-._;()/”.
Could you post the full DOI that seems to be problematic – I can then maybe see what is the problematic character.
You will then need to change your DOI so that they only use one of those allowed characters.
Unfortunately, currently there is no good automatic syntax check for the DOI in OJS – this will come in a future release…

Best,
Bozana

Im having the same problem
<?xml version=“1.0” encoding=“UTF-8”?>
<doi_batch_diagnostic status=“completed” sp=“ds5”>
<submission_id>1434501196</submission_id>
<batch_id>_1541608612</batch_id>
<record_diagnostic status=“Failure”>
<doi>10.26512/ser social.v20i42.14290</doi>
<msg>DOI: 10.26512/ser social.v20i42.14290 , contains invalid characters</msg>
</record_diagnostic>
<batch_data>
<record_count>1</record_count>
<success_count>0</success_count>
<warning_count>0</warning_count>
<failure_count>1</failure_count>
</batch_data>
</doi_batch_diagnostic>

Hi @thaysecantanhede

It seems that you are using spaces in your DOIs, which is not allowed, I think.
Could you adapt/fix one DOI and try to register it again?

Best,
Bozana

Dear Bozana, I am now trying to migrate a multilanguage journal (Ukrainian/Rusiian/English) with Ukrainain as a primary locale to OJS3.1.2 and have the following problem with CrossRef XML Export plugin: when I export the metadata into xml file, the content of the title and abstract fields is exported in Ukrainian (this fields are filled in all three languages). All other fields, including contributors names are in English. Could you suggest me a solution how to change this? Is it possible to indicate somewhere, which locale will be used for export into xml?
Thank you in advance, Igor
P.S. I also found that the title and abstract are exported in the language of submission…