Leaving xlink:href property out of database results in no property even if xlink:title is present

Description

Geoserver can be configured to deliver only xlink:title when hard-0coded in the configuration, but not when the values are coming from the datastore.
e.g.:
<AttributeMapping>
<targetAttribute>gsml:observationMethod</targetAttribute>
<ClientProperty>
<name>xlink:title</name>
<value>'unknown'</value>
</ClientProperty>
</AttributeMapping>

Gives:
<gsml:observationMethod xlink:title="unknown"/>

Getting it from the database where both xlink:href and xlink:title are present works:
<AttributeMapping>
<targetAttribute>gwml2:gwAquiferType</targetAttribute>
<ClientProperty>
<name>xlink:href</name>
<value>gwaquifertype_href</value>
</ClientProperty>
<ClientProperty>
<name>xlink:title</name>
<value>gwaquifertype_title</value>
</ClientProperty>
</AttributeMapping>

Generates:
<gwml2:gwAquiferType xlink:title="Unclassified" xlink:href="ngis/hgu-confiningtype.5"/>

Whereas if only xlink:title is requested it doesn't return any value:
<AttributeMapping>
<targetAttribute>gwml2:gwAquiferType</targetAttribute>
<!--<ClientProperty>
<name>xlink:href</name>
<value>gwaquifertype_href</value>
</ClientProperty> -->
<ClientProperty>
<name>xlink:title</name>
<value>gwaquifertype_title</value>
</ClientProperty>
</AttributeMapping>

Results in a missing <gwml2:gwAquiferType> tag.

Environment

None

Activity

Lingbo Jiang 
June 24, 2015 at 12:51 AM

Hi Bruce,

We just found that by adding one line "<encodeIfEmpty>true</encodeIfEmpty> " in xml Mapping, the xlink:title display correctly even without xlink:href.

Some bulletpoints about what we found:

1. this issue seems only to do with gwml2:gwAquiferType. Because some other elements (etc sam:sampledFeature) has no issue at all.
2.xmlSpy think xlink:title without href seems to be valid.
3.and we could not find anywhere in schema say xlink:href has to be with xlink:title.

Cheers,

//////////////sample xml mapping /////////////////////

<AttributeMapping>
<targetAttribute>gwml2:gwAquiferType</targetAttribute>
<!-- <ClientProperty> -->
<!-- <name>xlink:href</name> -->
<!-- <value>gwaquifertype_href</value> -->
<!-- </ClientProperty> -->
<ClientProperty>
<name>xlink:title</name>
<value>gwaquifertype_title</value>
</ClientProperty>
<encodeIfEmpty>true</encodeIfEmpty>
</AttributeMapping>
///////////////////////////////

Lingbo Jiang

Software Engineer
DP&S CSIRO
Cnr Vimiera & Pembroke Roads
MARSFIELD NSW 2122
Ph:+61-2-9372 4696
www.csiro.au/

Details

Assignee

Reporter

Priority

Created June 18, 2015 at 6:06 AM
Updated June 24, 2015 at 12:51 AM