File indexing completed on 2024-12-01 03:37:33
0001 /* 0002 This file is part of KDE. 0003 0004 SPDX-FileCopyrightText: 2009 Frederik Gladhorn <gladhorn@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "accountbalanceparser.h" 0010 0011 #include <QXmlStreamReader> 0012 0013 using namespace Attica; 0014 0015 QStringList AccountBalance::Parser::xmlElement() const 0016 { 0017 return QStringList(QStringLiteral("person")); 0018 } 0019 0020 AccountBalance AccountBalance::Parser::parseXml(QXmlStreamReader &xml) 0021 { 0022 AccountBalance item; 0023 0024 while (!xml.atEnd()) { 0025 xml.readNext(); 0026 if (xml.isStartElement()) { 0027 if (xml.name() == QLatin1String("balance")) { 0028 item.setBalance(xml.readElementText()); 0029 } else if (xml.name() == QLatin1String("currency")) { 0030 item.setCurrency(xml.readElementText()); 0031 } 0032 } 0033 } 0034 return item; 0035 }