From 25a313cc7af41c2c63231499c49cc1f3e382e019 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 7 May 2019 06:57:44 +0200 Subject: 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 --- src/xmlpatterns/schema/qxsdschemachecker.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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; } } -- cgit v1.2.1