Can't view XML file in OJS 3.0

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

Vitaly,

I had cleared the cache before I wrote my comment, but it wasn’t working. Thank you very much for the link to the working examples on elifesciences.org – I managed to figure out a bug in the conversion process of our XML (wrong metadata delivery). Now it’s working!

Have a good day!
Tobias

I strongly second this! There should be consistent behavior throughout all galley types. I’d prefer a head as the one above the pdfCanvasContainer.

Tobias

Greetings,

iFrames is not a very good solution. Really. I already tried to work with iframes in html galleys and there were several problems:

  1. strange behavior of inner links.
  2. not working external links. You can check it in you pdf files, if it contains them.
  3. strange behavior of external css and javascript.

Hi @Richard_Pilbery, I have the doubt, are there other ways to make a XML file compatible with the Lens Viewer? You added a working xml file in your answering post that’s why I asked you, If you know a way to make a xml file from a .doc or .pdf files. I hope you could answer, thansk and greetings.

I’d suggest checking out meTypeset from Martin Paul Eve, which I’ve used to create the example code. The code and instructions are on GitHub: GitHub - MartinPaulEve/meTypeset: meTypeset is a tool to convert from Microsoft Word .docx format to NLM/JATS-XML for scholarly/scientific article typesetting.. I’d also take a look at the Open Typesetting Stack, which is more automated: http://pkp-udev.lib.sfu.ca/ It’s been a while since I tried using the Open Typesetting Stack and I couldn’t get it to generate xml that would display using Lens Viewer, but things may well have moved on since I took a look a few months ago.

Hi @Richard_Pilbery thanks a lot for your response, I will check meTypeset from Martin Paul Eve, I used the Open Typesetting Stack from PKP and I got a XML file that I can use with Lens Viewer, however I wanna know if there are other ways to get a XML file.

Hi @Richard_Pilbery I followed your suggestion of using meTypeset from Martin Paul Eve for make a JATS XML file from my docx document, I checked your JATS XML file that you mentioned it in a post before, in that XML file you said what command you use for made it:
./meTypeset/bin/meTypeset.py docx input-filename.docx docx sample --interactive --zotero

then I used that same command with my document, however I can’t get the same result in the JATS XML document as you have in you xml document, precisely in the reference list. That’s why I asked you how you prepared your docx document before the parsing. I tell you that I have my docx document with citation and a list of bibliographic references to the last of my document and I added them with the Zotero extension for LibreOffice. I left my section of references list here:

<ref-list>
      <ref id="ID7dcf9519-6c6f-4513-bebd-29906a230e24">
        <mixed-citation>Darwin, C. (1859). <italic>On the Origin of Species by Means of Natural Selection, or the Preservation of Favoured Races in the Struggle for Life</italic>. London: John Murray.</mixed-citation>
      </ref>
      <ref id="IDdf3ef8e7-a7e7-41f3-90da-0bb64e5d678c">
        <mixed-citation>Lamark, J. B. (1809). <italic>Philoshopie zoologique</italic>.</mixed-citation>
      </ref>
    </ref-list>

But I want some like this

<ref-list>
      <ref id="IDa30d0966-cd34-448b-a969-f529a02822f8">
        <element-citation publication-type="bookchapter">
          <person-group person-group-type="author">
            <name>
              <surname>Kay</surname>
              <given-names>G. Neal</given-names>
            </name>
            <name>
              <surname>Dosdall</surname>
              <given-names>Derek J.</given-names>
            </name>
            <name>
              <surname>Shepard</surname>
              <given-names>Richard B.</given-names>
            </name>
          </person-group>
          <article-title>1 - Cardiac Electrical Stimulation</article-title>
          <source>Clinical Cardiac Pacing, Defibrillation and Resynchronization Therapy</source>
          <date>
            <year>2011</year>
          </date>
          <publisher-loc>Philadelpia</publisher-loc>
          <publisher-name>W.B. Saunders</publisher-name>
          <fpage>3</fpage>
          <lpage>39</lpage>
        </element-citation>
      </ref>
      <!--Kay, G. N., Dosdall, D. J., & Shepard, R. B. (2011). 1 - Cardiac Electrical Stimulation. In Clinical Cardiac Pacing, Defibrillation and Resynchronization Therapy (4th ed). Philadelpia: W.B. Saunders. Retrieved from http://www.sciencedirect.com/science/article/pii/B9781437716160000011
         -->
      <ref id="IDb8cd7093-a0d4-4ab1-a7a2-49beec15cbfb">
        <element-citation publication-type="book">
          <person-group person-group-type="author">
            <name>
              <surname>Rang</surname>
              <given-names>Humphrey P.</given-names>
            </name>
            <name>
              <surname>Dale</surname>
              <given-names>Maureen M.</given-names>
            </name>
            <name>
              <surname>Ritter</surname>
              <given-names>James M.</given-names>
            </name>
            <name>
              <surname>Flower</surname>
              <given-names>Rod J.</given-names>
            </name>
            <name>
              <surname>Henderson</surname>
              <given-names>Graeme</given-names>
            </name>
          </person-group>
          <source>Rang &amp; Dale's Pharmacology</source>
          <date>
            <year>3-31</year>
          </date>
          <publisher-loc>London</publisher-loc>
          <publisher-name>Churchill Livingstone</publisher-name>
        </element-citation>
      </ref>
      <!--Rang, H. P., Dale, M. M., Ritter, J. M., Flower, R. J., & Henderson, G. (2011). Rang & Dale&#8217;s Pharmacology (7th ed.). London: Churchill Livingstone.-->
    </ref-list>

I hope you can help me, thanks a lot for your time.

In the folder meTypeset, there is a subfolder called bin. Open the settings.xml file and find the mt:zotero</mt:zotero> tags. The filepath to your Zotero database needs to go here. I have a feeling that I exported mine and place it in the root directory where I was testing my XML setup as I could not get it to work when I referenced the original database. I’m running OSX v10.12 so it might be different if you are using an alternative setup.

Hi,
I’ve been away for a while but last week I tested the OTS plugin on a demonstration OJS3 instance - http://lib-garnett.lib.sfu.ca/ojs-plugin-alpha-9/index.php/mxn/article/view/1/4 - unfortunately with the same result as described above.
Have you reached any conclusion of how to solve the problem or have I overlooked a point?
Regards
PS I really look forward to see it working. It’s such a great tool integrated with the OJS.

Greetings,

It is likely that your JATS XML is not valid or somehow is incompatible with Lens Viewer. You can try to use my own parser written on Java, that we use for our journal: GitHub - Vitaliy-1/DOCX2JATS: Java project, aimed to facilitate DOCX to JATS XML transformation for scientific articles

But I am not guarantee anything :slight_smile:

1 Like

Greetings @nef,
I see from where your problem may arise. OJS seems still using old version of Lens Viewer. And I remember that an old version had many strange issues. For example for being properly processed journal publisher tag must contain eLife sciences as a publisher. I suggest to dowload new version of the plugin from their github repository.

Hi @nef,

Here is the link to the latest release: Releases · elifesciences/lens · GitHub
You just need to download and unpack lens-2.0.0.zip and overwrite corresponding files in the plugins directory. From you web root it will be here: plugins/generic/lensGalley/lib/lens
Don’t forget to make a backup just in case. I haven’t got any troubles in upgrading process.

1 Like

Hi,
Thank you for the answers, but I’m using a demonstration OJS3 instance for my testing set up by the OTS team, so I guess I can’t make an update.
Regards
Niels Erik

For all interested in why JATS XML viewer in loading internal by Lens Viewer.

It is happens mostly because lines like this in lens.js:
this.test = function(xmlDoc, documentUrl) { var publisherName = xmlDoc.querySelector("publisher-name").textContent; return publisherName === "eLife Sciences Publications, Ltd"; };
(lines 5086-5089)
First Lens Viewer checks the content of several tags in JATS XML, like “publisher-name” for example.
An than, if they are not containing specific for elifesciences information, Lens stops the conversion.

this.convertDocument = function(data) {
    var doc;
    var i = 0;
    while (!doc && i < this.converters.length) {
      var converter = this.converters[i];
      // First match will be used as the converter
      if (converter.test(data, this.config.document_url)) {
        doc = converter.import(data);
      }
      i += 1;
    }

    if (!doc) {
      throw new Error("No suitable converter found for this document", data);
    }

    return doc;
  };

New version of Lens Viewer don’t have these problems: Releases · elifesciences/lens · GitHub
Also

1 Like