Open ianwallen opened 4 years ago
@ianwallen For HTML formatter, the url should be (see md.format.html
instead of md.format.xml
):
Doesn't seem really to work with xml format, but if you need xml version you can use the following url:
http://localhost:8080/geonetwork/srv/api/records/093bac00-7a3e-44fa-801f-42144834e235/formatters/xml
@josegar74 you are correct that the html
formatter works better than the xml
formatter.
I was just pointing out that these interface seems to be buggy with these formatters. I would generally expect it to display a message saying that that formatter is unsupported or display something. But instead it is generating errors on the page and in the logs.
As I mentioned in the issue, I'm not sure where these formatter are used in the system. I have not seen any related issues other than in the administration section. As it is and administrator page, it is not a high priority for us at the moment as we only need to inform the administrator that this functionality is not currently working/buggy.
@ianwallen right, it's not related to HNAP, as fails also for iso19139
, the md.format
service accepts a format, but requires also to indicate the xslt that provides the response, that currently doesn't exists for xml.
I just remember we did this for other schema, see https://github.com/metadata101/iso19139.nl.geografie.2.0.0/tree/3.10.x/src/main/plugin/iso19139.nl.geografie.2.0.0/formatter/xml_view
This creates a html render with the xml content:
It can be added to HNAP, also to iso19139
. But note that to retrieve the raw xml, you need to use http://localhost:8080/geonetwork/srv/api/records/093bac00-7a3e-44fa-801f-42144834e235/formatters/xml
@josegar74. Regarding "the md.format service accepts a format, but requires also to indicate the xslt that provides the response, that currently doesn't exists for xml."
I don't believe we need to created the xslt because to my knowledge we don't have a requirement for this functionality. However I think it would be good if the xslt that provides the response does not exist then it should simply return and error from the interface stating "required xslt does not exist" or "unsupported format" instead of "Failed to compile stylesheet. 20 errors detected" and a bunch of errors in the logs.
So better handling of the error would probably be a good fix for now.
I'm not sure where the formatters are used but they currently don't seem to be working.
Did a local build, went to metadata and template -> formatters and attempted to use the HNAP formatters and they all seem to fail with the loaded HNAP templates/sample data (b16db0fe-a4ec-4844-819e-630e33137b6d).
http://localhost:8080/geonetwork/srv/eng/md.format.xml?uuid=b16db0fe-a4ec-4844-819e-630e33137b6d&xsl=ec-view&schema=iso19139.ca.HNAP
The following errors was logged to the console
http://localhost:8080/geonetwork/srv/eng/md.format.xml?uuid=b16db0fe-a4ec-4844-819e-630e33137b6d&xsl=full_view&schema=iso19139.ca.HNAP