diff options
author | Andy Shaw <andy.shaw@qt.io> | 2019-05-07 06:57:44 +0200 |
---|---|---|
committer | Andy Shaw <andy.shaw@qt.io> | 2019-05-07 08:41:22 +0000 |
commit | 25a313cc7af41c2c63231499c49cc1f3e382e019 (patch) | |
tree | 47c56669c909acc7e6e7370ce558680720d0de2e /src/xmlpatterns | |
parent | 8db585da3bb29c51be9ec8f7b719157e494b174e (diff) | |
download | qtxmlpatterns-25a313cc7af41c2c63231499c49cc1f3e382e019.tar.gz |
Allow union memberTypes as members of a SimpleType in a XSDSchema
In accordance to the standard, a SimpleType can have both union and
atomic type members in a XSDSchema.
Reference - https://www.w3.org/TR/xmlschema-2/#rf-defn
Fixes: QTBUG-74702
Change-Id: I337b5aeded843c06d7850a8b88d17178a38db79e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/xmlpatterns')
-rw-r--r-- | src/xmlpatterns/schema/qxsdschemachecker.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/xmlpatterns/schema/qxsdschemachecker.cpp b/src/xmlpatterns/schema/qxsdschemachecker.cpp index 5e4302d..57ee3e6 100644 --- a/src/xmlpatterns/schema/qxsdschemachecker.cpp +++ b/src/xmlpatterns/schema/qxsdschemachecker.cpp @@ -414,8 +414,8 @@ void XsdSchemaChecker::checkSimpleTypeConstraints() const XsdSimpleType::Ptr simpleItemType = itemType; const AnySimpleType::List memberTypes = simpleItemType->memberTypes(); for (int j = 0; j < memberTypes.count(); ++j) { - if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) { - m_context->error(QtXmlPatterns::tr("Variety of member types of %1 must be atomic.").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); + if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic && memberTypes.at(j)->category() != SchemaType::SimpleTypeUnion) { + m_context->error(QtXmlPatterns::tr("Variety of member types of %1 must be atomic or union.").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); return; } } @@ -891,8 +891,9 @@ void XsdSchemaChecker::checkSimpleDerivationRestrictions() const XsdSimpleType::Ptr simpleItemType = itemType; const AnySimpleType::List memberTypes = simpleItemType->memberTypes(); for (int j = 0; j < memberTypes.count(); ++j) { - if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic) { - m_context->error(QtXmlPatterns::tr("Variety of member types of %1 must be atomic.").arg(formatType(m_namePool, simpleItemType)), XsdSchemaContext::XSDError, location); + if (memberTypes.at(j)->category() != SchemaType::SimpleTypeAtomic && memberTypes.at(j)->category() != SchemaType::SimpleTypeUnion) { + m_context->error(QtXmlPatterns::tr("Variety of member types of %1 must be atomic or union.").arg(formatType(m_namePool, simpleItemType)), + XsdSchemaContext::XSDError, location); return; } } |