Does `QXmlStreamReader` guarantee that all character data inside an XML element comes in a single chunk? SAX parsers in general don't guaranteed that, so you might have to accumulate the character data and only process it once the element is closed (in this specific case, this would also allow you to get rid of the `nameElement`, `directoryElement` and `filenameElement` booleans, as you could collect all characters between a start tag and its corresponding end tag and then when checking which end tag it is, do the right thing with it (on start tag, empty the accumulator, on character data, append to the accumulator, on end tag, use the accumulated data and put it somewhere). This works if you don't have to deal with nested elements inside character data, which seems to be the case here.