pkp / pkp-lib

The library used by PKP's applications OJS, OMP and OPS, open source software for scholarly publishing.
https://pkp.sfu.ca
GNU General Public License v3.0
306 stars 445 forks source link

XML viewer not working: Cannot read property `textContent` of null #7066

Closed benaltair closed 3 years ago

benaltair commented 3 years ago

Describe the bug I can't view any JATS XML files that I've uploaded. I just see the spinner and get this error in the console:

Uncaught TypeError: Cannot read property 'textContent' of null
    at s.test (lens.js:3)
    at l.convertDocument (lens.js:5)
    at Object.<anonymous> (lens.js:5)
    at c (jquery.min.js?v=3.2.1.2:2)
    at Object.fireWith [as resolveWith] (jquery.min.js?v=3.2.1.2:2)
    at l (jquery.min.js?v=3.2.1.2:2)
    at XMLHttpRequest.<anonymous> (jquery.min.js?v=3.2.1.2:2)

To Reproduce Steps to reproduce the behavior:

  1. Add the XML file as a Galley (example)
  2. Click on the galley to open it on the publication page
  3. See spinner

What application are you using? OJS version 3.2.1.2

Additional information image

benaltair commented 3 years ago

On a second read, might be related to: https://github.com/pkp/pkp-lib/issues/6307

NateWr commented 3 years ago

Yeah, the Lens Reader breaks when it encounters JATS XML that it doesn't understand. And unfortunately JATS XML is very diverse so most XML won't load in it. I'll close this as a duplicate, but point you to this issue in our docs hub, where we discuss an XML Production Guide. The guide doesn't exist yet, and the short answer is that JATS XML is still very difficult to do reliably. But you may find some links to different tools and display strategies there.