Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QXmlQuery::evaluateTo problem
QtWS25 Last Chance

QXmlQuery::evaluateTo problem

Scheduled Pinned Locked Moved General and Desktop
4 Posts 4 Posters 2.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rddz
    wrote on last edited by
    #1

    Hi,

    I encounter a very strange issue with the evaluateTo method of QXmlQuery.

    My code parse an xml file (XPath format).
    On Linux, it works very well, on debug and release mode.
    On Mac and Windows, it works well on debug mode, but when i compile on release mode, the application crashes.
    The file I parse is approximately 1Mb size.

    If i reduce the file size by removing some nodes, it works well on release mode (Mac, Win)

    Here is the code.

    @
    void MyClass::getXpath(QString str, QString queryXpath, QString defaultNamespace)
    {
    QBuffer device;
    QStringList outArrayList;
    QXmlQuery query;

    device.setData(str.toUtf8());
    device.open(QIODevice::ReadOnly);
    query.bindVariable("stackfile", &device);
    query.setQuery(defaultNamespace+"declare variable $stackfile external;doc($stackfile)"+queryXpath);
    if(query.isValid() != true)
        qDebug() << "XPATH query is invalid !";
    

    // On windows and Mac, it crashes here on release mode with big filesize
    if(!query.evaluateTo(&outArrayList))
    qDebug() << "Cannot evaluate XPATH query !";

    device.close();
    ....
    
    return;
    

    }
    @

    Thanks for your help.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MiroT
      wrote on last edited by
      #2

      Hi,

      I just experienced the same behavior.
      Have you found any solution ?

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Alexis Wilke
        wrote on last edited by
        #3

        I also got the same error. Tracing the problem down, I can see the q.evaluateTo() function which crashes because of too many recursive calls.

        As we can see in this entry from gdb, it was called 74788 times before crashing. Quite a bit!

        #74788 0x00007ffff64510c9 in QPatternist::ItemMappingIterator<QPatternist::Item, QPatternist::Item, QExplicitlySharedDataPointer<QPatternist::GenericPredicate const>, QExplicitlySharedDataPointerQPatternist::DynamicContext >::next (this=0x73983c0) at iterators/qitemmappingiterator_p.h:120

        The XSLT works perfectly with smaller XML data. When it crashes, my file is a little over 2Mb, with an 8Gb computer, you'd think that it would not crash, although if more stack "than necessary" is used, it is not surprising...

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          Maybe worth to take a look at the bug report system to see if it's something known

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved