Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/xmlpatterns/schema/qxsdparticlechecker.cpp

    r561 r846  
    345345bool XsdParticleChecker::isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool)
    346346{
     347
     348    /**
     349     * In case we encounter an <xsd:all> element, don't construct a state machine, but use the approach
     350     * described at http://www.w3.org/TR/xmlschema-1/#non-ambig
     351     * Reason: For n elements inside the <xsd:all>, represented in the NDA, the state machine
     352     * constructs n! states in the DFA, which does not scale.
     353     */
     354    if (particle->term()->isModelGroup()) {
     355        const XsdModelGroup::Ptr group(particle->term());
     356        if (group->compositor() == XsdModelGroup::AllCompositor)
     357            return isUPAConformXsdAll(particle, namePool);
     358    }
     359
    347360    /**
    348361     * The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.2
     
    412425    }
    413426
     427    return true;
     428}
     429
     430bool XsdParticleChecker::isUPAConformXsdAll(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool)
     431{
     432    /**
     433     * see http://www.w3.org/TR/xmlschema-1/#non-ambig
     434     */
     435    const XsdModelGroup::Ptr group(particle->term());
     436    const XsdParticle::List particles = group->particles();
     437    const int count = particles.count();
     438    for (int left = 0; left < count; ++left) {
     439        for (int right = left+1; right < count; ++right) {
     440            if (termMatches(particles.at(left)->term(), particles.at(right)->term(), namePool))
     441                return false;
     442        }
     443    }
    414444    return true;
    415445}
Note: See TracChangeset for help on using the changeset viewer.