Qt XML
Qt XML 模块为 XML 提供 DOM 标准的实现。
注意: Qt XML 将不再提供附加功能。要迭代读写 XML 文档(SAX),请使用QXmlStreamReader 和QXmlStreamWriter 类。这些类更易于使用,也更符合 XML 标准。
该 Qt XML C++ Classes页面概述了本模块中的可用类。
使用模块
使用 Qt 模块需要直接或通过其他依赖关系与模块库链接。有几种构建工具为此提供了专门支持,包括CMake和qmake。
使用 CMake 构建
使用find_package()
命令在Qt6
软件包中找到所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS Xml) target_link_libraries(mytarget PRIVATE Qt6::Xml)
另请参阅使用 CMake 构建概述。
使用 qmake 构建
要配置使用 qmake 构建的模块,请在项目的 .pro 文件中添加模块作为QT
变量的值:
QT += xml
模块演变
Changes toQt XML列出了 Qt 6 系列 Qt 在模块 API 和功能上的重要变化。
许可证
Qt XML 模块可在Qt Company 的商业许可下使用。此外,它还受自由软件许可证的保护:GNU 宽通用公共许可证第 3 版或GNU 通用公共许可证第 2 版。更多详情,请参阅Qt 许可。
© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.