Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-35897

QPatternist::LiteralSequence Suppressed From Expressions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.5.1
    • 4.8.5, 5.2.0
    • XML: QtXmlPatterns
    • None
    • Tested this on Gentoo Linux x86_64 using the following Qt versions:

      QtXMLPatterns 4.8.5 from distribution sources
      QtXMLPatterns from Git v4.8.5-205-gece0bd5
      QtXMLPatterns from Git v5.2.0-beta1-13-ga250914
    • d17eba9d34f412e592c3b049c6c14fd9ccada87b

    Description

      Consider the following XQuery

      ("someString", tokenize("a,b",","))

      It should evaluate to the sequence

      ("someString", "a", "b")

      but Qt XML Patterns will suppress the ("a", "b") subsequence giving a result of

      ("someString")

      The reason is that QPatternist::ExpressionSequence::compress(const StaticContext::Ptr &context) has the following code

      else if(Id == IDExpressionSequence)

      { /* Rewrite "(1, (2, 3), 4)" into "(1, 2, 3, 4)" */ Expression::List::const_iterator seqIt((*it)->operands().constBegin()); const Expression::List::const_iterator seqEnd((*it)>operands().constEnd()); for(; seqIt != seqEnd; ++seqIt) result.append(*seqIt); }

      Since the ID of a QPatternist::LiteralSequence is IDExpressionSequence (see QPatternist::LiteralSequence::id()) and QPatternist::LiteralSequence inherits from QPatternist::EmptyContainer, which by design has no operands, nothing is added to the result variable in the compress method, so all of the values inside the QPatternist::LiteralSequence ("a" and "b" in the example above) are ignored.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            erikv Erik Verbruggen
            dmaggot David E. Narváez
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes