[Geoserver-users] Why the WFS does not return the NULL value field?

Hello dear sir,
    As is known, the GML format responseXML of WFS cannot return the fields
which have NULL value.But I need the fileds name, how to do it? For example
,if I have two fileds(name,and cname) in the PostGIS Talbe,and published the
table to the geoserver, and I can visit it via WFS. The 'cname' filed is not
defined NOT NULL. So when I parse the result GML using firstChild.NodeValue,
it has error. Because if any record of the Table has a null value in the
'cname' filed, the reponseXML of WFS would not return
'<gml:cname>null</gml:cname>', but nothing. I know I can solve this problem
via checking the length of the 'cname' node.But it is a awkward and
unpractical way, if there are several dozens of fileds.
  So, I want to consult that can WFS of GeoServer return the filed name,if
the value of the filed is NULL? Like '<gml:cname>null</gml:cname>',and how
to do it? Thank you very much!
    
--
View this message in context: http://www.nabble.com/Why-the--WFS--does-not-return-the-NULL-value-field--tp25306238p25306238.html
Sent from the GeoServer - User mailing list archive at Nabble.com.

Kevin Yang ha scritto:

Hello dear sir,
    As is known, the GML format responseXML of WFS cannot return the fields
which have NULL value.But I need the fileds name, how to do it?

Parse the DescribeFeatureType response for the same feature type. That contains all of the fields and it's how a WFS
client is supposed to learn about the structure of the GetFeature response.

Cheers
Andrea

--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.

Andrea Aime wrote:

Kevin Yang ha scritto:

Hello dear sir,
    As is known, the GML format responseXML of WFS cannot return the fields
which have NULL value.But I need the fileds name, how to do it?

Parse the DescribeFeatureType response for the same feature type. That contains all of the fields and it's how a WFS
client is supposed to learn about the structure of the GetFeature response.

It should also be noted that this behavior is mandated by the WFS spec specification. GML and WFS explicitly avoid the use of "xs:nil" which would allow for the inclusion of elements with null values.

Cheers
Andrea

--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.