Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QDomDocumentType QDomImplementation::createDocumentType ( const QString qName,
const QString publicId,
const QString systemId 
)

Creates a document type node for the name qName.

publicId specifies the public identifier of the external subset. If you specify an empty string (QString()) as the publicId, this means that the document type has no public identifier.

systemId specifies the system identifier of the external subset. If you specify an empty string as the systemId, this means that the document type has no system identifier.

Since you cannot have a public identifier without a system identifier, the public identifier is set to an empty string if there is no system identifier.

DOM level 2 does not support any other document type declaration features.

The only way you can use a document type that was created this way, is in combination with the createDocument() function to create a QDomDocument with this document type.

In the DOM specification, this is the only way to create a non-null document. For historical reasons, Qt also allows to create the document using the default empty constructor. The resulting document is null, but becomes non-null when a factory function, for example QDomDocument::createElement(), is called. The document also becomes non-null when setContent() is called.

See also:
createDocument()

Definition at line 1007 of file qdom.cpp.

References QString::isNull().

{
    bool ok;
    QString fixedName = fixedXmlName(qName, &ok, true);
    if (!ok)
        return QDomDocumentType();

    QString fixedPublicId = fixedPubidLiteral(publicId, &ok);
    if (!ok)
        return QDomDocumentType();

    QString fixedSystemId = fixedSystemLiteral(systemId, &ok);
    if (!ok)
        return QDomDocumentType();

    QDomDocumentTypePrivate *dt = new QDomDocumentTypePrivate(0);
    dt->name = fixedName;
    if (systemId.isNull()) {
        dt->publicId.clear();
        dt->systemId.clear();
    } else {
        dt->publicId = fixedPublicId;
        dt->systemId = fixedSystemId;
    }
    dt->ref.deref();
    return QDomDocumentType(dt);
}


Generated by  Doxygen 1.6.0   Back to index