Hello Frédéric

I have a somewhat philosophical question for you. I have been reported that the "xlink:href" attribute were sometime lost when marshalling a metadata object to XML. In my understanding, that attribute is used for replacing a verbose definition. For example instead of:

   <gmd:citation>
      <gmd:CI_Citation>
        <gmd:responsibleParty>
          <gmd:CI_ResponsibleParty>
            <gmd:organisationName>
               Apache
               ... etc for a very long XML


one could write for instance:

   <gmd:citation xlink:href="http://...#apache"/>


Where the URL is a link to an other XML document containing the complete <gmd:CI_Citation> definition. In the current Apache SIS implementation, those two representations are mutually exclusive. The rational was that when a xlink:href is provided, the normal intend is to not marshal the complete element below it, otherwise the xlink:href would be pointless.

This raise the question of what to do when both xlink:href and a metadata definition are provided. In current implementation, SIS uses the xlink:href form only if the user has explicitly flagged his metadata object has "nil" by implementing the NilObject interface [1]. If a metadata object is non-nil, then SIS conservatively marshal the whole object instead, no matter if a xlink:href is defined or not. It would be technically easy to both marshal the whole object and to write the xlink:href attribute, but I'm not sure if it make sense to do that in every cases (xlink:href are not identifiers - there is other attributes for the later).

Actually the user has control on whether to marshal the whole metadata or only xlink:href (but currently no control on whether SIS should marshal both together) by overriding the ReferenceResolver method. My question is about what should be the default behaviour?

    Martin


[1] http://sis.apache.org/apidocs/org/apache/sis/xml/NilObject.html
[2] 
http://sis.apache.org/apidocs/org/apache/sis/xml/ReferenceResolver.html#canSubstituteByReference%28org.apache.sis.xml.MarshalContext,%20java.lang.Class,%20T,%20org.apache.sis.xml.XLink%29


Reply via email to