Aha! This is the complex-type-with-simple-content problem. I recall 
encountering it when adding support for gml:CodeType, which has the same 
information model mismatch, but without the complication of an anyType 
in the mix.

Have you tried using TargetAttributeNode to set the property to 
gml:CodeType or another type with simple content?

Writing new code should be a last resort. SWE-specific code should be 
avoided. app-schema should support any valid GML 3.x application schema. 
GML3EncodingUtils contains the magic for unpacking simpleContent 
smuggled in a complex type.

Kind regards,
Ben.

On 09/10/15 03:09, Stefano Costa wrote:
> Dear all,
> I'm working on mapping some data stored in a database to the OGC SWE schema
> using app-schema.
>
> I'm having troubles mapping to swe:DataArray/swe:values, which is an
> element of type swe:EncodedValuesPropertyType, whose definition follows:
>
> /* taken from http://schemas.opengis.net/sweCommon/2.0/basic_types.xsd */
>
> <complexType name="EncodedValuesPropertyType">
>    <complexContent>
>      <extension base="anyType">
>        <attributeGroup ref="swe:AssociationAttributeGroup" />
>      </extension>
>    </complexContent>
> </complexType>
>
> It should be possible to set a simple string value in the element, as shown
> in the INSPIRE O&M Guidelines document
> <http://inspire.ec.europa.eu/documents/Data_Specifications/D2.9_O&M_Guidelines_v2.0rc3.pdf>,
> Annex A, Par. A.1 (third example).
>
> After some struggling and debugging, the problem seems to be
> that swe:values's attribute type, being a complex type, is bound to
> java.util.Collection:
> descriptor.getType().toString() ---> ComplexTypeImpl
> http://www.opengis.net/swe/2.0:EncodedValuesPropertyType extends anyType()
> descriptor.getType().getBinding().toString() ---> interface
> java.util.Collection
>
> so, when app-schema tries to set its value to a java.lang.String instance,
> the conversion fails and the attribute's value is set to null:
> XPath.convertValue(descriptor, value) ---> returns null
>
> Any ideas on how to overcome this issue? Should I come up with my own
> bindings for the SWE schema?
>
> I can provide further details if needed.
>
> Thanks in advance!
>
>
>
> ------------------------------------------------------------------------------
>
>
>
> _______________________________________________
> GeoTools-Devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/geotools-devel
>

-- 
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to