C++ QXmlStreamReader说我';M在XML文件的结尾,而在中间
您好,问题是我正在使用QXmlStreamReader读取一个XML文件来读取日历中的约会,但是当我从C++ QXmlStreamReader说我';M在XML文件的结尾,而在中间,c++,xml,qt,C++,Xml,Qt,您好,问题是我正在使用QXmlStreamReader读取一个XML文件来读取日历中的约会,但是当我从AppointmentSolo切换到AppointmentRepeatatEnd()时,由于某种原因返回true 这是XML文件 <?xml version="1.0" encoding="UTF-8"?> <AppointmentSolo> <Length>1</Length> <AppointmentSolo0>
AppointmentSolo
切换到AppointmentRepeat
atEnd()时,由于某种原因返回true
这是XML文件
<?xml version="1.0" encoding="UTF-8"?>
<AppointmentSolo>
<Length>1</Length>
<AppointmentSolo0>
<Date>10 09 2011</Date>
<Begin>15:11</Begin>
<End>23:12</End>
<Title>Final test</Title>
<Description>Final countdown</Description>
<hasNotify>1</hasNotify>
<notify>17</notify>
</AppointmentSolo0>
</AppointmentSolo>
<AppointmentRepeat>
<Length>1</Length>
<AppointmentRepeat0>
<Date>08 01 2014</Date>
<Begin>20:08</Begin>
<End>23:09</End>
<Type>MONTHLY</Type>
<Exceptions>
<Length>1</Length>
<Exception0>08 09 2014</Exception0>
</Exceptions>
<Title>Repeat test</Title>
<Description>FooBar</Description>
<hasNotify>0</hasNotify>
<notify>0</notify>
</AppointmentRepeat0>
</AppointmentRepeat>
这似乎是一个QXmlStreamReader::NotWellFormedError
由于读取的XML格式不正确,解析器在内部引发了一个错误。
但是为什么我的XML格式不好呢
编辑:似乎发生了一个错误(我添加了“XML只能有,所以您的XML无效。XML只能有,所以您的XML无效。您的意思是我必须将我的和放在a中?您的意思是我必须将我的和放在a中?
if(Rxml.isEndElement() && Rxml.name() == "AppointmentSolo")
{
qDebug() << Rxml.atEnd() << Rxml.name() << Rxml.hasError();
Rxml.readNext();
qDebug() << Rxml.atEnd() << Rxml.name() << Rxml.hasError();
qDebug() << Rxml.error();
while(!Rxml.atEnd() && !Rxml.isStartElement())//om aan begin tag te zijn
{
Rxml.readNext();
qDebug() << Rxml.atEnd() << Rxml.name() << Rxml.hasError();
}
}
false "AppointmentSolo" false
true "AppointmentRepeat" true
3