Hi, I have a WFS source that I try to fetch features from. The response is quite complex, and I've been using org.geotools.data.wfs.impl.WFSDataAccessFactory within gt-wfs-ng. I feel there is something wrong about how this xml are represented as a object graph of Property, but there are so many JUnit tests confirming this structure, so I'm not sure how to make it better. There is also a lack of documentation / examples on how the structure should be.
Here is an example of what the xml looks like: <wfs:member> <app:Kommune xmlns:app="http://skjema.geonorge.no/SOSI/produktspesifikasjon/AdmEnheter/4.1" gml:id="kommune_view.357"> <app:identifikasjon> <app:Identifikasjon> <app:lokalId>173103</app:lokalId> <app:navnerom>https://data.geonorge.no/sosi/administrativeenheter/fylker_kommuner</app:navnerom> <app:versjonId>4.1</app:versjonId> </app:Identifikasjon> </app:identifikasjon> <app:oppdateringsdato>2020-02-07T00:00:00</app:oppdateringsdato> <app:datauttaksdato>2021-01-04T10:07:10</app:datauttaksdato> <app:område> <!--Inlined geometry 'kommune_view.357_APP_OMRÅDE'--> <gml:Polygon gml:id="kommune_view.357_APP_OMRÅDE" srsName="urn:ogc:def:crs:EPSG::4258"> <gml:exterior> <gml:LinearRing> <gml:posList>58.426581 6.605405 .....</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </app:område> <app:kommunenummer>4207</app:kommunenummer> <app:kommunenavn> <app:AdministrativEnhetNavn> <app:navn>Flekkefjord</app:navn> <app:språk>nor</app:språk> </app:AdministrativEnhetNavn> </app:kommunenavn> <app:samiskForvaltningsområde>false</app:samiskForvaltningsområde> </app:Kommune> </wfs:member> The <wfs:member><app:Kommune> is the root for a singe Feature. When calling getProperties you will get all the child elements of Kommune represented as a subclass of Property. That contains a name, value and binding. This works great for ordinary values as string, dates, boolean and geometry. The problem is when there's a child element, like for instance <app:kommunenavn>. This is represented as a ComplexAttribute and has a Collection as a value. The Collection is actually a Collection of Property's. Underneath I've tried to represent this. Ordinary Attribute's are written as: "name [type] : value", while ComplexAttribute's are written "name {" with new indentation for their nested properties: samiskForvaltningsområde [java.lang.Boolean]: false IdentifikasjonPropertyType { Identifikasjon { IdentifikasjonType { lokalId [java.lang.String]: 173103 navnerom [java.lang.String]: https://data.geonorge.no/sosi/ versjonId [java.lang.String]: 4.1 } } } kommunenummer [java.lang.String]: 4207 AdministrativEnhetNavnPropertyType { AdministrativEnhetNavn { AdministrativEnhetNavnType { navn [java.lang.String]: Flekkefjord språk [java.lang.String]: nor } } } oppdateringsdato [java.sql.Timestamp]: 2020-02-07 01:00:00.0 område [org.locationtech.jts.geom.Polygon]: POLYGON ((58.426581 6.605405, datauttaksdato [java.sql.Timestamp]: 2021-01-04 11:07:10.0 I would like "IdentifikasjonPropertyType" to have the name "identifikasjon", and the property IdentifikasjonType is superfluous. The same goes for AdministrativEnhetNavnPropertyType. It should be called kommunenavn, and AdministrativEnhetNavnType is superfluous. Do anyone have an idea why it's done like it is today, or do anyone have an opinion about my changes? It would be nice to hear about them. How could I go forward to implement these changes? Best regards, Roar Brænden
_______________________________________________ GeoTools-Devel mailing list GeoTools-Devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-devel