Ejemplo n.º 1
0
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);
}
Ejemplo n.º 2
0
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);
    }
}