Can't view XML file in OJS 3.0

Hi
I’ve been using PKP’s Open Typesetting Stack to generate a XML file from a .doc file. After publishing the XML file in my test journal in OJS 3.0 I can’t view it. The browser window continues loading article

The eLife Lens Article Viewer is enabled.
What am I doing wrong? Any suggestions?
Regards
Niels Erik

Hi @nef,

Is that URL publicly available? If so, could you fire me a complete URL? (Also tagging @axfelix.)

Thanks,
Alec Smecher
Public Knowledge Project Team

Hi Alec

Thanks a lot. The XML file is here: http://ojs3-devel.statsbiblioteket.dk/nef/article/view/4

Regards

Niels Erik
Niels Erik Frederiksen
Forskningsbibliotekar, cand. mag. / Research Librarian, MA
Studie- og Forskningsservice
DIRECT +45 8946 2179
MOBILE +45 2167 2417
email: nef@statsbiblioteket.dkmailto:nef@statsbiblioteket.dk

VICTOR ALBECKS VEJ 1
8000 AARHUS C

CVR/SE 1010 0682 - EAN 5798000791084

Hi @nef (and @axfelix),

It looks like the JATS XML doesn’t validate:

  4-13-62-2-10-20161019.xml:5: element journal-meta: validity error : Element journal-meta content does not follow the DTD, expecting (journal-id+ , journal-title-group* , issn+ , isbn* , publisher? , notes?), got 
    <journal-meta/>
                   ^
/tmp/4-13-62-2-10-20161019.xml:13: element article-meta: validity error : Element article-meta content does not follow the DTD, expecting (article-id* , article-categories? , title-group , (contrib-group | aff)* , author-notes? , pub-date+ , volume? , volume-id* , volume-series? , issue? , issue-id* , issue-title* , issue-sponsor* , issue-part? , isbn* , supplement? , ((fpage , lpage? , page-range?) | elocation-id)? , (email | ext-link | uri | product | supplementary-material)* , history? , permissions? , self-uri* , related-article* , abstract* , trans-abstract* , kwd-group* , funding-group* , conference* , counts? , custom-meta-group?), got (title-group abstract )
    </article-meta>
                   ^

Regards,
Alec Smecher
Public Knowledge Project Team

I’ll have a look into it. It looks like we might simply not have gotten enough front matter out of the input file that was provided to our stack, and the JATS Viewer as configured in OJS is being strict about how much front matter needs to be included with the article to pass validation.

Greetings,
As I wrote earlier, lens viewer is not working properly without some modifications of javascript file. It seems like lens.js was added to ojs3 from elifesciences.org without modifications. It contains all external links to this site (to images directory, article category etc). Also there are interesting functions like check the publisher name in xml file and if it is not “eLife Sciences Publications, Ltd”, then don load content. I am not the programmer so do not have enough skills to edit all those mistakes. All I have done for now is change all links and tags according to our journal. Simply commenting unnecesery checks throws an error.

Thanks, @Vitaliy – possibly not on our end then. @asmecher, how did you actually pull down the XML from the linked journal? I can’t seem to yank the link out of OJS3 without the renderer working, I haven’t figured out the tricks yet :slight_smile:

Hi @axfelix,

You can pull down the XML by looking at the source for the Lens viewer page. You’ll see a snippet like…

 $(document).ready(function(){
    var app = new Lens({
        document_url: "http://some-url-here"
    });
    app.start();
    window.app = app;
});

The document_url provides the source for the XML.

Regards,
Alec Smecher
Public Knowledge Project Team

Aha, thanks – I’d gotten as far as Ctrl+F’ing “.xml” in the source and gave up :slight_smile:

OK, just did a little bit of debugging and it seems like the upstream Lens viewer will die if the //journal-meta/publisher/publisher-name element is missing. @nef and @Vitaliy, thanks for your help here – I’m not seeing any evidence that we need the eLife Sciences string, just that this element can’t be missing. It’s not always output by our stack because it’s not one of the most common things for us to be able to parse out, so I can definitely see this causing some frustration in the short term; I’ll add a fix to OTS so that this element is always filled if it’s missing.

Fix has been deployed to the OTS demo site.

1 Like

Sorry, but I’m still not able to open the XML. If you choose the XML2 you’ll see the result:
http://ojs3-devel.statsbiblioteket.dk/nef/issue/view/4
Regards
Niels Erik

I think I’ve found the problem. It’s a coding error and I’ve raised an issue on GitHub: https://github.com/pkp/pkp-lib/issues/1954

If you are feeling brave, you could remove 3 lines of code in the lens.js file. It’s located in: OJS > plugins > generic > lensGallery > lib > lens. You need to remove lines 5506–5508 which are:

this.test = function(xml, documentUrl) {
 return;
};

…and you’ll end up with something like this:

1 Like

Greetings @Richard_Pilbery,

And what exactly this code does?
As I see lens.js on loading performs validation procedure. If removing the code disables it, it is not the ideal solution.

In this prototype, the code does nothing, except that it should return TRUE for an ‘if’ statement later on. As it is, it returns undefined, which makes the code fail. In addition, there is another function called test in this prototype that does return TRUE. I’m no javascript guru, but two functions with the same name in a prototype is not a good idea, I suspect.

1 Like

Further to my last, there is an update of lens, so you can just insert the new files directly into your OJS installation. There release is here: https://github.com/elifesciences/lens/releases/tag/2.0.0. It has been marked for updating in OJS: https://github.com/asmecher/lensGalley/issues/9

1 Like

I have the same issue: infinite »Loading article«.

First I tried to disable the lines in lens.js as described above – no success.
Then I replaced with the file from Release Lens 2.0.0 · elifesciences/lens · GitHub – no success.

I replaced my XML file with the one from http://ojs3-devel.statsbiblioteket.dk/nef/article/view/48 and corrected the XML validation errors – no success.

Any further ideas? And: Is there a working XML example?

Niels Erik’s page still isn’t working as well …

Regards
Tobias

1 Like

I’d suggest completely replacing everything in the lens folder with the updated v2.0.0 files.
You can find a working XML file here (which I’ve created and tested on my OJS v3 installation.)

1 Like

Greetings @Richard_Pilbery,

Many thanks for this info. I have updated without problems. There is one issue that I am thinking about. There is no “return” button is Lens viewer.

Good day @twa,

After updating there is a need to clear data caches in OJS. Plugin is working well in my case. There are a lot of working examples at https://elifesciences.org/

1 Like