I have an issue where a couple of article galley XML files are not being converted by the eLife Lens Article Viewer. The browser hangs with ‘Loading article’ displayed. Checking the console output I find the following:
lens.js:formatted:109 Uncaught TypeError: Cannot read property ‘getNodes’ of undefined
at s.getHeadings (lens.js:formatted:109)
at Object. (lens.js:formatted:7067)
at fire (VM894 jquery.js:3099)
at Object.fireWith [as resolveWith] (VM894 jquery.js:3211)
at done (VM894 jquery.js:9310)
at XMLHttpRequest.callback (VM894 jquery.js:9720)
Now the strange thing is if I add the two documents in question to an issue galley (as opposed to an article galley), they convert successfully.
I have around 20 other XML files that convert without issue in article galleys.
I’d be grateful for any suggestions as to what the problem may be.
The most probable reason is that you have a specific XML node inside the file that is not support by Lens Viewer Plugin.
Thanks for your response. Do you know where I can find out which XML nodes are supported? I mentioned that the files transform correctly if added to an issue galley whereas they don’t if added to an article galley. Do you have an idea why that might be?
I haven’t seen the listing of supported nodes anywhere. As far as I remember there are some strict requirements only for elements/node in the article metadata.
This line means that the Lens Viewer tries to retrieve nodes from the element that doesn’t exist. So, on the second look, the problem is not because of an unsupported node but because the node that is required by Lens was missed. You can simply compare this article with another one that renders properly.
I’ve had this problem too. In my case the files weren’t valide. You can validate in Chrome. The files should also pass the pmc style checker. PMC Style Checker
Thanks @Vitaliy and @trace for your responses. I have closely compared the problematic files to files that correctly transform and I’m struggling to see any differences.
I have validated the files via http://jats4r.org/validator/ which returns one error.
ERROR: Missing <copyright-holder>. When an article is under copyright (i.e. it is not in the public domain) we recommend that <copyright-holder> be given.
I think this is a red herring as the error appears on all of the XML documents I’ve validated. I have added the tag to test but it made no difference.
I’ve also run the documents through the PMC style checker and no errors were returned.
I’m slightly stumped.
It’s not necessary that developers of Lens Viewer complied strictly with JATS XML standards. Have you looked at nodes inside the
front element? I guess the best way would be check them one by one.
You can send me one of these files by email if you like. I can then take a look at it. I’ll send you my email.
Thanks @Vitaliy I’ll pore over the front element and see if I can discover anything spurious.
Thanks @trace that’s very kind. Please forward me your email and I’ll send through a file.
I did that allready. May you check your message box in your profile.
The problem are the hex-coded figures. When you just link to it like
<fig id="fig1" position="float" fig-type="figure">
<caption><p>Division of Livestock-Associated Tasks Within Households (N=49)</p>
it will work.
Thanks @trace for having a look. All of the images in all of the the XML assets in the journal are encoded. None are stored locally. It is just two XML files that are failing to be typeset and all the rest are rendering fine and displaying the encoded images. The file I sent you does typeset correctly and display the encoded images if it is added as an issue galley rather than an article galley. This is what I don’t understand. I’m going to remove the images and see what happens and go over the
front element as suggested by Vitaliy with a fine tooth comb. Thanks very much for your time.