mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-23 00:02:38 -05:00
Fix metadata address element doubles with each project write
elementsByTagName can be dangerous, because it returns children recursively. In this case the contact "address" element contained a child element for the street address, also named "address". So when restoring a project with contact addresses in the metadata, each address was created twice... Fixes #17940
This commit is contained in:
parent
5812934c69
commit
36bf093b85
@ -440,7 +440,7 @@ bool QgsLayerMetadata::readMetadataXml( const QDomElement &metadataElement )
|
||||
oneContact.role = mne.namedItem( QStringLiteral( "role" ) ).toElement().text();
|
||||
|
||||
QList< QgsLayerMetadata::Address > addresses;
|
||||
QDomNodeList addressList = mne.elementsByTagName( QStringLiteral( "address" ) );
|
||||
QDomNodeList addressList = mne.elementsByTagName( QStringLiteral( "contactAddress" ) );
|
||||
for ( int j = 0; j < addressList.size(); j++ )
|
||||
{
|
||||
QDomElement addressElement = addressList.at( j ).toElement();
|
||||
@ -663,7 +663,7 @@ bool QgsLayerMetadata::writeMetadataXml( QDomElement &metadataElement, QDomDocum
|
||||
|
||||
for ( const QgsLayerMetadata::Address &oneAddress : contact.addresses )
|
||||
{
|
||||
QDomElement addressElement = document.createElement( QStringLiteral( "address" ) );
|
||||
QDomElement addressElement = document.createElement( QStringLiteral( "contactAddress" ) );
|
||||
QDomElement typeElement = document.createElement( QStringLiteral( "type" ) );
|
||||
QDomElement addressDetailedElement = document.createElement( QStringLiteral( "address" ) );
|
||||
QDomElement cityElement = document.createElement( QStringLiteral( "city" ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user