void XsdSchemaDebugger::dumpInheritance(const SchemaType::Ptr &type, int level)
{
    QString prefix; prefix.fill(QLatin1Char(' '), level);
    qDebug("%s-->%s", qPrintable(prefix), qPrintable(type->displayName(m_namePool)));
    if (type->wxsSuperType())
        dumpInheritance(type->wxsSuperType(), ++level);
}
示例#2
0
bool AnyType::wxsTypeMatches(const SchemaType::Ptr &other) const
{
    if(other)
        return this == other.data() ? true : wxsTypeMatches(other->wxsSuperType());
    else
        return false;
}
void XsdSchemaDebugger::dumpType(const SchemaType::Ptr &type)
{
    if (type->isComplexType()) {
        const XsdComplexType::Ptr complexType(type);
        qDebug("\n+++ Complex Type +++");
        qDebug("Name: %s (abstract: %s)", qPrintable(complexType->displayName(m_namePool)), complexType->isAbstract() ? "yes" : "no");
        if (complexType->wxsSuperType())
            qDebug("  base type: %s", qPrintable(complexType->wxsSuperType()->displayName(m_namePool)));
        else
            qDebug("  base type: (none)");
        if (complexType->contentType()->variety() == XsdComplexType::ContentType::Empty)
            qDebug("  content type: empty");
        if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple)
            qDebug("  content type: simple");
        if (complexType->contentType()->variety() == XsdComplexType::ContentType::ElementOnly)
            qDebug("  content type: element-only");
        if (complexType->contentType()->variety() == XsdComplexType::ContentType::Mixed)
            qDebug("  content type: mixed");
        if (complexType->contentType()->variety() == XsdComplexType::ContentType::Simple) {
            if (complexType->contentType()->simpleType())
                qDebug("  simple type: %s", qPrintable(complexType->contentType()->simpleType()->displayName(m_namePool)));
            else
                qDebug("  simple type: (none)");
        }

        const XsdAttributeUse::List uses = complexType->attributeUses();
        qDebug("   %d attributes", uses.count());
        for (int i = 0; i < uses.count(); ++i) {
            qDebug("      attr: %s", qPrintable(uses.at(i)->attribute()->displayName(m_namePool)));
        }
        qDebug("   has attribute wildcard: %s", complexType->attributeWildcard() ? "yes" : "no");
        if (complexType->attributeWildcard()) {
            dumpWildcard(complexType->attributeWildcard());
        }

        if (complexType->contentType()->particle()) {
            dumpParticle(complexType->contentType()->particle(), 5);
        }
    } else {
        qDebug("\n+++ Simple Type +++");
        qDebug("Name: %s", qPrintable(type->displayName(m_namePool)));
        if (type->isDefinedBySchema()) {
            const XsdSimpleType::Ptr simpleType(type);
            if (simpleType->primitiveType())
                qDebug("  primitive type: %s", qPrintable(simpleType->primitiveType()->displayName(m_namePool)));
            else
                qDebug("  primitive type: (none)");
        }
        dumpInheritance(type, 0);
    }
}
示例#4
0
void XsdSchema::addAnonymousType(const SchemaType::Ptr &type)
{
    const QWriteLocker locker(&m_lock);

    // search for not used anonymous type name
    QXmlName typeName = type->name(m_namePool);
    while (m_anonymousTypes.contains(typeName)) {
        typeName = m_namePool->allocateQName(QString(), QLatin1String("merged_") + m_namePool->stringForLocalName(typeName.localName()), QString());
    }

    m_anonymousTypes.insert(typeName, type);
}
示例#5
0
AtomicValue::Ptr ValueFactory::fromLexical(const QString &lexicalValue,
                                           const SchemaType::Ptr &type,
                                           const ReportContext::Ptr &context,
                                           const SourceLocationReflection *const sourceLocationReflection)
{
    Q_ASSERT(context);
    Q_ASSERT(type);
    Q_ASSERT_X(type->category() == SchemaType::SimpleTypeAtomic, Q_FUNC_INFO,
               "We can only construct for atomic values.");

    return PerformValueConstruction(sourceLocationReflection, type)(AtomicString::fromValue(lexicalValue),
                                                                    type,
                                                                    context);
}
示例#6
0
void XsdSchema::addType(const SchemaType::Ptr &type)
{
    const QWriteLocker locker(&m_lock);

    m_types.insert(type->name(m_namePool), type);
}