Dear all,
we have observed that geonetwork changes the schemaLocation of a metadata
record when it outputs it via the OAI-PHM provider.
Interestingly, this even happens if there is already a perfectly valid
schemaLocation for the schema in question.
The issue is related to, but was not fixed by
http://trac.osgeo.org/geonetwork/ticket/373
I have identified the buildRecord function in GetRecord.java and
ListRecords.java as the culprits.
GN replaces the schemaLocation with a local one, if the schema requested
by the OAI harvester is equal to the schema the metadata record is stored
in. A transformation is attempted otherwise.
You will fine the relevant code below.
A solution would probably only replace the schemaLocation if there was
none already, along the lines of the fix for ticket 373.
For the forthcoming fix, it would be good if the 100% code duplication
between buildRecord in Getrecord and ListRecords, was addressed and I
would also like to point out that the fix in Show.java:131 seems to be of
poor coding style, since the schemaLocation is hardcoded in the code.
Questions to the community. Would a fix that only added a schemaLocation
if the metadata record has not one already break something?
Is there a way to get the schemaLocation from a centrally configurable
place rather than hardcoding it?
best regards
Timo
P.S.: I have checked out GN 2.6.3 to attempt a fix but I am getting
complication errors, due to missing geonetworkResumptionToken. Any hints
why that is?
if (prefix.equals(schema)) {
String schemaUrl = Lib.getSchemaUrl(context, schemaDir);
String schemaLoc = md.getNamespace().getURI() +" "+ schemaUrl;
md.setAttribute("schemaLocation", schemaLoc, OaiPmh.Namespaces.XSI);
} else {
if (Lib.existsConverter(schemaDir, prefix)) {
md = Lib.transform(schemaDir, md, uuid, changeDate, prefix,
context.getBaseUrl(), dm.getSiteURL(), gc.getSiteName());
} else {
throw new CannotDisseminateFormatException("Unknown prefix : "+ prefix);
}
}