Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #2832 from m-kuhn/checkXmlKeys
Don't use invalid xml values as attribute names
  • Loading branch information
m-kuhn committed Feb 23, 2016
2 parents 5085204 + 58751b5 commit 2e8097b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/core/qgseditformconfig.cpp
Expand Up @@ -242,7 +242,15 @@ void QgsEditFormConfig::readXml( const QDomNode& node )
for ( int j = 0; j < cfgElem.attributes().size(); ++j )
{
QDomAttr attr = cfgElem.attributes().item( j ).toAttr();
cfg[attr.name()] = attr.value();
cfg.insert( attr.name(), attr.value() );
}

QDomNodeList optionElements = cfgElem.elementsByTagName( "option" );
for ( int j = 0; j < optionElements.size(); ++j )
{
QString key = optionElements.at( j ).toElement().attribute( "key" );
QString value = optionElements.at( j ).toElement().attribute( "value" );
cfg.insert( key, value );
}

setWidgetConfig( wdgElem.attribute( "name" ), cfg );
Expand Down Expand Up @@ -337,7 +345,10 @@ void QgsEditFormConfig::writeXml( QDomNode& node ) const

while ( cfgIt != configIt.value().constEnd() )
{
configElem.setAttribute( cfgIt.key(), cfgIt.value().toString() );
QDomElement optionElem = doc.createElement( "option" );
optionElem.setAttribute( "key", cfgIt.key() );
optionElem.setAttribute( "value", cfgIt.value().toString() );
configElem.appendChild( optionElem );
++cfgIt;
}

Expand Down

0 comments on commit 2e8097b

Please sign in to comment.