Hello Martin, the xlink:href attribute is there to reference a linked information. There are use cases where the value is an additional information to the content of the element.
<gmd:keyword> <gmx:Anchor xlink:href="http://vocab.ndg.nerc.ac.uk/term/C161/0/55" xlink:actuate="onRequest">Bering Sea</gmx:Anchor> </gmd:keyword> In this case, the link points to some semantic description of the term, which is the content of the element. That's the kind of case where you need to keep both. Unfortunately, there is no strict logic to know if the link is the equivalent to the content. You could decide that if the content is XML, then the link shall point to the equivalent, but I'm not sure it is the reality. So, I would say that the Java representation of such XML construct shall keep the content, shall keep the link value and eventually having some helper to resolve the link and maybe parse it. Hope that helps. Frédéric On 11 December 2013 18:13, Martin Desruisseaux < [email protected]> wrote: > 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" <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 > > > -- *Frédéric Houbie* Systems architect / Geospatial Project Manager url : www.geomatys.com | e-mail : [email protected] *Office* Maison de la Télédétection 500 rue Jean-François Breton 34093 Montpellier Cedex 5 France Phone : +33 (0)4 84 49 02 26 Fax: +33 (0)4 67 54 87 00 *Home Office* 26 Avenue François Bovesse 4053 Embourg Belgique Phone 1 : + 33 (0)4 11 93 42 97 Phone 2 : + 32 (0)4 287 02 33 Mobile : +32 (0)494 43 01 08
