c++qtreadxml

QT C++ Project (Creating Login with XML)


I have question about my internship project. They want me to create a basic Login page(ID, Password). I create a XML file for Username and Password. The program should check the XML file for username and password*. If they are correct it will direct to a second window. I'm stuck on processing XML file for username and password. How can read those information in XML file.


Solution

  • As @JarMan said, I would recommend the QXmlStreamReader. You can fill it with a file (QIODevice), QString, QByteArray, etc...

    Parsing a value could e.g. look like that

    xml.attributes().value( attribute ).toString();
    

    if attribute is a QString and xml is the QXmlStreamReader.

    See the doc https://doc.qt.io/qt-5/qxmlstreamreader.html