Hello,

I was testing out the 1.0-jdk8-SNAPSHOT version of Apache SIS (from the
JDK8 branch on GitHub) when I ran into an issue unmarshalling ISO 19139
metadata beginning with the MI_Metadata element.
The specific metadata document can be found here [1].

The code I am using to unmarshal looks something like this:

1 InputStream inputStream = ... (contains metadata);
2 MarshallerPool pool = new MarshallerPool(null);
3 Unmarshaller unmarshaller = pool.acquireUnmarshaller();
4 unmarshaller.setProperty(XML.METADATA_VERSION,
LegacyNamespaces.VERSION_2007);
5 Metadata metadata = (Metadata) unmarshaller.unmarshal(inputStream);
6 pool.recycle(unmarshaller);

The javax.xml.bind.UnmarshalException that I get occurs at line 5 in this
example. The important bits are here:

unexpected element (uri:"http://www.isotc211.org/2005/gmi";,
local:"MI_Metadata").
Expected elements are ...<{
http://standards.iso.org/iso/19115/-2/gmi/1.0}MI_Metadata>, ...

It seems to me that the org.apache.sis.xml.TransformingReader responsible
for converting the namespace URI of the MI_Metadata element to something
understandable by JAXB (an ISO 19115-3 URI) is not doing its job in this
case.
I believe the cause is that a key/value pair for MI_Metadata is never added
to the outerElementProperties field of the org.apache.sis.xml.Transformer
class.

This seems like a regression, since ISO 19139-2 was supported in previous
versions of SIS. I do not see it listed as a known issue on the SIS-345
issue page [2].
It is also possible that due to the API changes in SIS recently, I may have
done something incorrectly in the above mock code. If this is the case,
please let me know.

[1]
https://catalog.data.gov/harvest/object/d2901928-f55b-4ef3-88e9-9de7d3e30554
[2] https://issues.apache.org/jira/browse/SIS-345

Thanks,

Cullen Rombach
Image Matters LLC
www.imagemattersllc.com

Reply via email to