PDA

View Full Version : QXmlStreamReader error on reading empty element



tuli
30th November 2013, 07:01
When i parse an XML document using the QXmlStreamReader class, i am presented with an error if i call "readElementText()" on an empty element and my parsing is interrupted. The error is:


Expected character data.

Apparently, this is expected behavior.

So how can i know whether an element is empty or not?

anda_skoa
30th November 2013, 12:03
Some ideas:

- Call readNext() and check if the token is Charactes, i.e. isCharacters() returns true
- Check if calling isEndElement() is true

Cheers,
_