[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kphotoalbum] XMLDB: Don't escape strings for xml attribute values.
From: Johannes Zarl <isilmendil () isilme ! lupus ! uberspace ! de>
Date: 2013-04-30 23:22:00
Message-ID: 20130430232200.544BAA6071 () git ! kde ! org
[Download RAW message or body]
Git commit 55340bc57cb49cf2ca529f1fede80ce178bdfd90 by Johannes Zarl.
Committed on 01/05/2013 at 01:20.
Pushed by johanneszarl into branch 'master'.
Don't escape strings for xml attribute values.
BUG: 319135
M +6 -2 XMLDB/FileWriter.cpp
http://commits.kde.org/kphotoalbum/55340bc57cb49cf2ca529f1fede80ce178bdfd90
diff --git a/XMLDB/FileWriter.cpp b/XMLDB/FileWriter.cpp
index fb862fe..b7c0dbb 100644
--- a/XMLDB/FileWriter.cpp
+++ b/XMLDB/FileWriter.cpp
@@ -102,7 +102,7 @@ void XMLDB::FileWriter::saveCategories( QXmlStreamWriter& writer \
) Q_FOREACH(const QString &name, categories) {
DB::CategoryPtr category = \
DB::ImageDB::instance()->categoryCollection()->categoryForName( name \
);
ElementWriter dummy(writer, QString::fromLatin1("Category") );
- writer.writeAttribute( QString::fromLatin1("name"), escape( name ) );
+ writer.writeAttribute( QString::fromLatin1("name"), name );
writer.writeAttribute( QString::fromLatin1( "icon" ), \
category->iconName() );
writer.writeAttribute( QString::fromLatin1( "show" ), \
QString::number(category->doShow()) ); @@ -269,7 +269,7 @@ void \
XMLDB::FileWriter::writeCategories( QXmlStreamWriter& writer, const DB::Ima if ( \
!items.isEmpty() ) { topElm.writeStartElement();
categoryElm.writeStartElement();
- writer.writeAttribute( QString::fromLatin1("name"), escape( name ) );
+ writer.writeAttribute( QString::fromLatin1("name"), name );
}
Q_FOREACH(const QString& itemValue, items) {
@@ -320,6 +320,10 @@ bool XMLDB::FileWriter::shouldSaveCategory( const QString& \
categoryName ) const return shouldSave;
}
+/**
+ * Escape problematic characters in a string that forms an XML attribute name.
+ * N.B.: Attribute values do not need to be escaped!
+ */
QString XMLDB::FileWriter::escape( const QString& str )
{
static QHash<QString,QString> cache;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic