QXmlStreamReader/QXmlStreamWriter实现Qt下xml文件读写

本文介绍了如何使用QXmlStreamReader和QXmlStreamWriter在Qt中进行XML文件的读写操作。讲解了QXml-Token标记类型,提供了一个范例xml文件,并给出了读写xml的详细步骤。强调在读取时要注意完整的包含关系,避免干扰。最后提到了Qt的其他XML处理方法,如SAX和DOM方式。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

介绍

帮助文档:QXmlStreamReaderQXmlStreamWriter

除此以外读取时还需要使用QXmlStreamAttributes

QXml-Token标记类型

Constant Value Description
QXmlStreamReader::NoToken 0 The reader has not yet read anything.
QXmlStreamReader::Invalid 1 An error has occurred, reported in error() and errorString().
QXmlStreamReader::StartDocument 2 The reader reports the XML version number in documentVersion(), and the encoding as specified in the XML document in documentEncoding(). If the document is declared standalone, isStandaloneDocument() returns true; otherwise it returns false.
QXmlStreamReader::EndDocument 3 The reader reports the end of the document.
QXmlStreamReader::StartElement 4 The reader reports the start of an element with namespaceUri() and name(). Empty elements are also reported as StartElement, followed directly by EndElement. The convenience function
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值