@@ -522,6 +522,12 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
522
522
QStringList::const_iterator alstIt;
523
523
QList<int > idxList;
524
524
QgsFields fields = layer->pendingFields ();
525
+ // build corresponding propertyname
526
+ QList<QString> propertynames;
527
+ for ( int idx = 0 ; idx < fields.count (); ++idx )
528
+ {
529
+ propertynames.append ( fields[idx].name ().replace ( " " , " _" ) );
530
+ }
525
531
QString fieldName;
526
532
QDomElement propertyElem;
527
533
for ( int q = 0 ; q < queryChildNodes.size (); q++ )
@@ -534,7 +540,7 @@ int QgsWFSServer::getFeature( QgsRequestHandler& request, const QString& format
534
540
{
535
541
fieldName = fieldName.section ( " :" , 1 , 1 );
536
542
}
537
- int fieldNameIdx = fields. fieldNameIndex ( fieldName );
543
+ int fieldNameIdx = propertynames. indexOf ( fieldName );
538
544
if ( fieldNameIdx > -1 )
539
545
{
540
546
idxList.append ( fieldNameIdx );
@@ -2047,7 +2053,7 @@ QDomElement QgsWFSServer::createFeatureGML2( QgsFeature* feat, QDomDocument& doc
2047
2053
continue ;
2048
2054
}
2049
2055
2050
- QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( QString ( " " ), QString ( " _" ) ) );
2056
+ QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( " " , " _" ) );
2051
2057
QDomText fieldText = doc.createTextNode ( featureAttributes[idx].toString () );
2052
2058
fieldElem.appendChild ( fieldText );
2053
2059
typeNameElement.appendChild ( fieldElem );
@@ -2129,7 +2135,7 @@ QDomElement QgsWFSServer::createFeatureGML3( QgsFeature* feat, QDomDocument& doc
2129
2135
continue ;
2130
2136
}
2131
2137
2132
- QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( QString ( " " ), QString ( " _" ) ) );
2138
+ QDomElement fieldElem = doc.createElement ( " qgs:" + attributeName.replace ( " " , " _" ) );
2133
2139
QDomText fieldText = doc.createTextNode ( featureAttributes[idx].toString () );
2134
2140
fieldElem.appendChild ( fieldText );
2135
2141
typeNameElement.appendChild ( fieldElem );
0 commit comments