Skip to content
Snippets Groups Projects
Commit 5e335361 authored by Jesper Zedlitz's avatar Jesper Zedlitz
Browse files

sometime the prefix 'gmd' is not assigned to the GMD namespace

parent e8e6f2f8
No related branches found
No related tags found
No related merge requests found
Pipeline #506 passed
......@@ -378,6 +378,7 @@ public class MDMetadata2Dataset {
throw new IllegalArgumentException("Input must be a gmd:MD_Metadata element.");
}
metadata.addNamespace("gmd", "http://www.isotc211.org/2005/gmd");
if (null == metadata.selectSingleNode("gmd:hierarchyLevel/gmd:MD_ScopeCode[@codeListValue='service']")) {
throw new IllegalArgumentException("Input is not a service");
}
......
......@@ -1069,6 +1069,16 @@ public class MDMetadata2DatasetTests {
assertTrue(result.isEmpty());
}
/**
* The gmd prefix is not bound in this document.
*/
@Test
public void convertServiceToDistributions_noGmdPrefix() throws Exception{
final Document inputDocument = saxReader.read(getClass().getResourceAsStream("/d65a2641-1a2e-4011-b729-2e5578efe68c.xml"));
Collection<Resource> result = service.convertServiceToDistributions(inputDocument.getRootElement());
assertNotNull(result);
assertEquals(1, result.size());
}
/**
* Parameter is not a gmd:MD_Metadata element.
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment