Important: Please read the Qt Code of Conduct -

QXmlSchemaValidator trouble with size of xml input.

  • Hello.

    I'm trying to validate an xml document against a schema using the validate method on the QXmlSchemaValidator class.
    The xml I'm trying to validate has the form:
    <description />
    <interval id="1">
    <task id="task1">

    ... more intervals


    My problem: when i have less than 100 (curiously a round number) intervals the validate() method works fine. If I add a new interval the validate() method fails with "Element interval is not defined in this scope.", sugesting a size constraint of some sort. The overloaded method I use is using QByteArray as input.

    The content of all the intervals is identical and I have validated it sucessfully using other tools.

    Does anybody have a hint to what could be wrong?

  • I have the same problem when trying to validate() the xml for my app. 100 card elements is the limit. After that the validate() method returns with "Element card is not defined in this scope." In the schema I have minOccurs="8" and maxOccurs="2048" for the card element. If I set maxOccurs to 100 or less then it works fine for occurences <= 100 card elements. If I set maxOccurs to unbounded then it works fine for any number of card elements. So in my case the solution is to set maxOccurs to unbounded and move the limiting of the number of card elements to the application logic.

    Tim Reilly

Log in to reply