简体   繁体   中英

Reading a xml file in c++

I want to read a .xml file and access its tags in c++. I used "QDomDocument":

QDomDocument m_doc;
QFile file_read( "test.xml" );

but receive this error:

"'QDomDocument' was not declared in this scope"

I know that I should add a library to my source code like:

#include ...

but I don't know which library is suitable for using "QDomDocument", can any one help me, please. I appreciate your attention.

Qt have well designed docs . Almost every class in Qt have own header same as class name. just type^

#include <QDomDocument>

But there in Qt is one hideout. Qt pretty big lib and it dived into few modules. And QDomDocument is placed in XML .

And for compiling you also need add line to projectfile(typical auto genereted by qtcreator [projname].pro):

QT += xml

QDomDocument is part of library Qt . In order to use it you need to get the Qt library and set it up on your machine. Then you need to link your project to the Qt library.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM