summaryrefslogtreecommitdiffstats
path: root/src/xmlpatterns/schema/qxsdparticlechecker.cpp
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-06-14 14:58:28 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-06-14 14:58:28 (GMT)
commitb6f32b841c27670a8a69889f073b179e7a4844b2 (patch)
tree3c0e3a22e92ed230c9bfb051663b597c5031e15c /src/xmlpatterns/schema/qxsdparticlechecker.cpp
parent442784de39c8128f418354fdcfdb3988bb599104 (diff)
parentb00cd9859d8b666b851953ee3b37def0ab078a54 (diff)
downloadQt-b6f32b841c27670a8a69889f073b179e7a4844b2.zip
Qt-b6f32b841c27670a8a69889f073b179e7a4844b2.tar.gz
Qt-b6f32b841c27670a8a69889f073b179e7a4844b2.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (57 commits) QXmlSchema: allow usage of xsd:all QSslSocket: fix build for MinGW and VS 2005 Fix symbian-abld build failure with bearer plugins remove certificate bundle make QSslSocket::systemCaCertificates() use system certs Adjusted RegExp in QSslCertificate::fromPath() Fix QSystemTrayIcon::supportsMessages() on Windows Use NIM_SETVERSION to get the latest behavior Cleanup obsolete stuff doc: Added DITA XML generator Fixed a broken merge. Changed the way we detect touch screen on Windows. Fixed error deploying qsymbianbearer.qtplugin on Symbian. Revert "Attempt to fix build failure on Symbian." Attempt to fix build failure on Symbian. Replaced redundant "!contains" scopes in "contains(A, B) {...} !contains(A, B) {...}" constructions with "else" Updated leading whitespace to make indentation more consistent Updated project files so it is now possible to use "-system-zlib" configuration option on Windows and Symbian platforms. make postgresql support sensitive to PSQL_LIBS support for cross building Qt for MinGW (win32-g++) on Unix ...
Diffstat (limited to 'src/xmlpatterns/schema/qxsdparticlechecker.cpp')
-rw-r--r--src/xmlpatterns/schema/qxsdparticlechecker.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/xmlpatterns/schema/qxsdparticlechecker.cpp b/src/xmlpatterns/schema/qxsdparticlechecker.cpp
index ef1d135..15c2afe 100644
--- a/src/xmlpatterns/schema/qxsdparticlechecker.cpp
+++ b/src/xmlpatterns/schema/qxsdparticlechecker.cpp
@@ -344,6 +344,19 @@ bool XsdParticleChecker::hasDuplicatedElements(const XsdParticle::Ptr &particle,
bool XsdParticleChecker::isUPAConform(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool)
{
+
+ /**
+ * In case we encounter an <xsd:all> element, don't construct a state machine, but use the approach
+ * described at http://www.w3.org/TR/xmlschema-1/#non-ambig
+ * Reason: For n elements inside the <xsd:all>, represented in the NDA, the state machine
+ * constructs n! states in the DFA, which does not scale.
+ */
+ if (particle->term()->isModelGroup()) {
+ const XsdModelGroup::Ptr group(particle->term());
+ if (group->compositor() == XsdModelGroup::AllCompositor)
+ return isUPAConformXsdAll(particle, namePool);
+ }
+
/**
* The algorithm is implemented like described in http://www.ltg.ed.ac.uk/~ht/XML_Europe_2003.html#S2.2
*/
@@ -414,6 +427,23 @@ bool XsdParticleChecker::isUPAConform(const XsdParticle::Ptr &particle, const Na
return true;
}
+bool XsdParticleChecker::isUPAConformXsdAll(const XsdParticle::Ptr &particle, const NamePool::Ptr &namePool)
+{
+ /**
+ * see http://www.w3.org/TR/xmlschema-1/#non-ambig
+ */
+ const XsdModelGroup::Ptr group(particle->term());
+ const XsdParticle::List particles = group->particles();
+ const int count = particles.count();
+ for (int left = 0; left < count; ++left) {
+ for (int right = left+1; right < count; ++right) {
+ if (termMatches(particles.at(left)->term(), particles.at(right)->term(), namePool))
+ return false;
+ }
+ }
+ return true;
+}
+
bool XsdParticleChecker::subsumes(const XsdParticle::Ptr &particle, const XsdParticle::Ptr &derivedParticle, const XsdSchemaContext::Ptr &context, QString &errorMsg)
{
/**