XML parsing problem (error triggered by consumer)

  • Hello,

    I'm trying to parse XML data that I recieve over a bluetooth socket by passing the QByteArray to the XML handler.
    The process works and the full data is transmitted but parsing fails on line 2, column 6 of the XML file even though the XML is completely legal (checked with W3Schools validator).

    Here's the function that takes and parses the XML:
    @bool SaxHandler::readFile(const QByteArray &data)

    QXmlInputSource source;
    QXmlSimpleReader xmlReader;
    qDebug() << source.data();
    return xmlReader.parse(source);


    Here's the console output, also showing the contents of the XML file (The error details come from the error handler):
    @"<?xml version="1.0"?>

    fatalError: "error triggered by consumer"
    lineNumber: 2
    columnNumber: 6@

    The error seems to be between the 'a' and the '>', but I see nothing wrong and the XML is legal.
    What could possibly be wrong?

    Thanks in advance!

  • Looks like the problem is in my content handler, if i comment it out the parsing succeeds.

    I guess it was stupid of me to leave implementing it for later, all i had there was a qDebug() which i omitted from the above posts output. I just wanted to test if everyting works before i continue working, time to implement the handler then :)

    Thanks anyway!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.