@@ -523,6 +523,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
523
523
QStringList::const_iterator alstIt;
524
524
QList<int > idxList;
525
525
QgsFields fields = layer->pendingFields ();
526
+ // build corresponding propertyname
527
+ QList<QString> propertynames;
528
+ for ( int idx = 0 ; idx < fields.count (); ++idx )
529
+ {
530
+ propertynames.append ( fields[idx].name ().replace ( " " , " _" ) );
531
+ }
526
532
QString fieldName;
527
533
QDomElement propertyElem;
528
534
for ( int q = 0 ; q < queryChildNodes.size (); q++ )
@@ -535,7 +541,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
535
541
{
536
542
fieldName = fieldName.section ( " :" , 1 , 1 );
537
543
}
538
- int fieldNameIdx = fields. fieldNameIndex ( fieldName );
544
+ int fieldNameIdx = propertynames. indexOf ( fieldName );
539
545
if ( fieldNameIdx > -1 )
540
546
{
541
547
idxList.append ( fieldNameIdx );
@@ -2072,7 +2078,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
2072
2078
continue ;
2073
2079
}
2074
2080
2075
- QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( QString ( " " ), QString ( " _" ) ) );
2081
+ QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( " " , " _" ) );
2076
2082
QDomText fieldText = doc.createTextNode ( featureAttributes[idx].toString () );
2077
2083
fieldElem.appendChild ( fieldText );
2078
2084
typeNameElement.appendChild ( fieldElem );
@@ -2156,7 +2162,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
2156
2162
continue ;
2157
2163
}
2158
2164
2159
- QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( QString ( " " ), QString ( " _" ) ) );
2165
+ QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( " " , " _" ) );
2160
2166
QDomText fieldText = doc.createTextNode ( featureAttributes[idx].toString () );
2161
2167
fieldElem.appendChild ( fieldText );
2162
2168
typeNameElement.appendChild ( fieldElem );
0 commit comments