Figures not loaded using JatsParser and Old Gregg on OJS 3.1

Hello @Vitaliy

I’m trying to use JatsParser on OJS 3.1 togheter with the OldGregg theme

It works everything well, except that I can’t get the figures loaded in the article.

The XML should be ok, it’s the same that I’ve used for publishing the articles on PubMedCentral.

Here is an example of the xml used for the figures:

<p>Of the 4926 papers identified through the ........ (<xref ref-type="fig" rid="fig001">Fig. 1</xref>). However, ....... selection of the relevant papers.</p>
..............
..............
<fig id="fig001" position="float">
<label>Fig. 1.</label>
<caption><p>Flow diagram showing the methodology of the study.</p></caption>
<graphic xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://actaitalica-ojs3.archicoop.it/public/xml-images/aoi-2018-04-279-g001.png" mime-subtype="png"/>
</fig>

I tried to use both the of the following methods:
a) uploading images’ files directly through OJS dashboard as attached to the JATS XML
b) absolute link to the image that I’d previously uploaded in a public dir of the website

Neither of them seems working.

Can anyone here kindly help me to understand what am I doing wrong?

Thanks in advance for your help

Hi @razzi

Hmm, only full link doesn’t work? Did you try attaching the image to XML galley with pointing only file name with extension, e.g. fig1.png?

Does this problem occur when using them separately? It is relevant for XML galley page or article page?

Also, I don’t recommend to keep these 2 plugins together on one installation. Old Gregg theme already has article full text on article landing page. There can be unexpected coercions.

Hi @Vitaliy , and thanks for the quick replay :smile:

Coming to your questions:

  • i’m speaking of the Article page (here is an example of url : /index.php/aoi/article/view/1)
  • both full link and images attached to XML galleys didn’t work.
    I first tried via attached XML galleys that didn’t work. Then I tried via full link, also not working
  • I tried using it separately and togheter; same result

About the use of images attached to the XML galley, for what I read on some posts in this forum,
it seams tha cannot work if the article files are outside the document root of the web site, which is the configuration for my web site. Can you confirm this, or this limitation has been removed in the more recent version of the OldGregg?

Regarding your suggestion for “not keeping the 2 plugins togneter”,
I’ve just realized that I misunderstood how to use the OldGregg theme:
I’ thought that the theme was “prepared” for using the JatsParser plugin and not that it included the plugin.

That’s why I’m using both.
I’ll deactivate the JatsParser plugin and check if the problem gets fixed.

It’s better to keep only one of them on the system. If you don’t need JATS Parser plugin I’d recommend to delete it, not just disable. If they are both inside OJS instance, Old Gregg theme will use JATS Parser library from a plugin (even if it is disabled), but not from itself and they have different version that are not always compatible. The problem with figures probably arises from it.

OK, I’ll check it removing the JATS Parser plugin from the plugins folder.

Meanwhile I’ve tried to import the XML file that you give as an XML example in the JATS Parser plugin
(https://github.com/Vitaliy-1/JATSParserPlugin/blob/master/example.xml).
In this case the images are correctly loaded!!!

Does this means that my XML file do not respect the XML format required by JATSParser?

Can you address me for the right informations about the valid XML format required by JATS Plugin?

This is a link to the XML that was giving me the problems for loading images that I had described in my intial post: http://actaitalica-ojs3.archicoop.it/aoi-2018-04-279.xml

Can you tell me if it’s a valid format?

Thanks a lot again for your help.

Hi @Vitaliy

I tried to deactivate and remove the JATS Parser plugin form the plugin’s folder.
This crashes the article view page (/index.php/aoi/article/view/1) with an apache error 500.
Readingf the apahce erro log I see:

PHP Fatal error: Uncaught Error: Class 'JATSParser\\Body\\Document' not found in /var/www/vhosts/actaitalica-ojs3.archicoop.it/plugins/themes/oldGregg/OldGreggThemePlugin.inc.php:185\nStack trace:\n#0 /var/www/vhosts/actaitalica-ojs3.archicoop.it/lib/pkp/classes/plugins/HookRegistry.inc.php(107): OldGreggThemePlugin->jatsParser('TemplateManager...', Array)\n#1 /var/www/vhosts/actaitalica-ojs3.archicoop.it/lib/pkp/classes/template/PKPTemplateManager.inc.php(856): HookRegistry::call('TemplateManager...', Array)\n#2 /var/www/vhosts/actaitalica-ojs3.archicoop.it/pages/article/ArticleHandler.inc.php(197): PKPTemplateManager->display('frontend/pages/...')\n#3 /var/www/vhosts/actaitalica-ojs3.archicoop.it/lib/pkp/classes/core/PKPRouter.inc.php(372): ArticleHandler->view(Array, Object(Request))\n#4 /var/www/vhosts/actaitalica-ojs3.archicoop.it/lib/pkp/classes/core/PKPPageRouter.inc.php(233): PKPRouter->_authorizeInitializeAndCallRequest(Array, Object(Request), Array, false)\n#5 /var/www/vhosts/actaitalica-ojs3.archicoop.it/lib/pkp/classes/cor in /var/www/vhosts/actaitalica-ojs3.archicoop.it/plugins/themes/oldGregg/OldGreggThemePlugin.inc.php on line 185, referer: http://actaitalica-ojs3.archicoop.it/index.php/aoi/issue/view/2

If I put back the JATS Parser plugin the error disappear.

Morover, looking at the OldGregg Readmy file on gitHub
(https://github.com/Vitaliy-1/oldGregg/tree/master)
I see the following:

This is a custom theme for the latest OJS 3 release. It is based on Bootstrap 4 framework and uses JATS Parser Plugin for automatic rendering of articles in JATS XML format and displaying them on article landing page.

where I understand that the JATS Parser plugin is required. Is there something that I’m not understanding?

Thanks so much


--------- UPDATES TO THIS POST ------------------

After some investigations, I found out that the php error described above can be fixed by commenting out the following lines in the OldGregThemePlugin.inc.php (located at rows 17-20 in the root of the OldGregg theme plugin)

		// $pluginSettingsDAO = DAORegistry::getDAO('PluginSettingsDAO');
		// $context = PKPApplication::getRequest()->getContext();
		// $contextId = $context ? $context->getId() : 0;
		// $jatsParserSettings = $pluginSettingsDAO->getPluginSettings($contextId, 'JatsParserPlugin');
		
		if (!class_exists('\JATSParser\Body\Document', true) && empty($jatsParserSettings)) {
			require_once  __DIR__ . '/jatsParser/src/start.php';
		}

If I’m not wrong, the if tha contain the require_once is not executed because empty($jatsParserSettings) is false even if the JATSParser plugin is not active and the plugin code not present in the plugin’s directory.
And this happens because the plugin’s settings are not removed from the the DB after the plugin is disabled.
So, once the JATSParser Plugin has been installed in a the OJS instance, the oldGregg theme detect the plugin installed, no matter if it has been disabled and removed.
Maybe a different test is needed here for checking the plugin’s installation?

I reply to myself here, because I’ve understood what is the the problem with the images not loaded in my XML articles:
it seems that images and tables that are enclosed in the
<floats-group> </floats-group>
tag don’t get parsed by the JATS Parser.

I don’t know if this is the expected behaviour for the parser, though.

If keeping short, plugin is quite sensitive to elements that are direct children of the section. So, if you wrap some basic element, like table, figure or list, it won’t be parsed. But most of inside this elements are parsed with XPath’s double slash: https://way2tutorial.com/xml/xpath_introduction.php

In the xml file that are giving me trobles, the tag
<floats-group> </floats-group>
is not a child of the section.
It is rather a brother, on same level of section.
It is positioned after all the section, as the final parrt of the XML file

JATS XML format actually is not quite strict, it is rather a problem because I can’t take into account all possible options for element position. But I’m right now working with DOCX to JATS XML converter, which will give standardized output. It will be available as a plugin to OJS 3.1+

The library is almost done, maybe several weekends and it will be ready: GitHub - Vitaliy-1/docxToJats: DOCX to JATS XML Converter

Hi Vitaly,
how can install this library?
I installed the JATS plugin on OJS 3.1.1.4 and the XML file does not show me images or tables, can I correct this?

Thanks
Bye
Tiziano

Hi @Tiziano,

Can you specify what version of JATS Parser plugin have you downloaded?

Yes, i downloaded jatsParser.2.0.0 version.

Bye
Tiziano

Should work. I’ve replied you in the parallel thread: oldGregg theme JatsParser plugin is not accepting the XML tags for the image - #4 by Vitaliy

Insert this tag in the XML (which is in bold)

tag_figures
immediately before the end of the body tag (blue color)

After placing the tag, you can see the figures in the HTML. Please tell me how the result is

JatsParser works ok.

Insert this tag in the XML (which is in bold)

tag_figures
After placing the tag, you can see the figures in the HTML. Please tell me how the result is