Home · All Classes · Main Classes · Grouped Classes · Modules · Functions

QDomImplementation Class Reference
[QtXml module]

The QDomImplementation class provides information about the features of the DOM implementation. More...

#include <QDomImplementation>

Note: All the functions in this class are reentrant.

Public Types

Public Functions

Static Public Members


Detailed Description

The QDomImplementation class provides information about the features of the DOM implementation.

This class describes the features that are supported by the DOM implementation. Currently the XML subset of DOM Level 1 and DOM Level 2 Core are supported.

Normally you will use the function QDomDocument::implementation() to get the implementation object.

You can create a new document type with createDocumentType() and a new document with createDocument().

For further information about the Document Object Model see Level 1 and Level 2 Core. For a more general introduction of the DOM implementation see the QDomDocument documentation.

See also hasFeature().


Member Type Documentation

enum QDomImplementation::InvalidDataPolicy

This enum specifies what should be done when a factory function in QDomDocument is called with invalid data.

ConstantValueDescription
QDomImplementation::AcceptInvalidChars0The data should be stored in the DOM object anyway. In this case the resulting XML document might not be well-formed. This is the default value and QDom's behavior in Qt < 4.1.
QDomImplementation::DropInvalidChars1The invalid characters should be removed from the data.
QDomImplementation::ReturnNullNode2The factory function should return a null node.

See also setInvalidDataPolicy() and invalidDataPolicy().


Member Function Documentation

QDomImplementation::QDomImplementation ()

Constructs a QDomImplementation object.

QDomImplementation::QDomImplementation ( const QDomImplementation & x )

Constructs a copy of x.

QDomImplementation::~QDomImplementation ()

Destroys the object and frees its resources.

QDomDocument QDomImplementation::createDocument ( const QString & nsURI, const QString & qName, const QDomDocumentType & doctype )

Creates a DOM document with the document type doctype. This function also adds a root element node with the qualified name qName and the namespace URI nsURI.

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.

See also createDocument().

bool QDomImplementation::hasFeature ( const QString & feature, const QString & version ) const

The function returns true if QDom implements the requested version of a feature; otherwise returns false.

The currently supported features and their versions:

FeatureVersion
XML1.0

InvalidDataPolicy QDomImplementation::invalidDataPolicy ()   [static]

Returns the invalid data policy, which specifies what should be done when a factory function in QDomDocument is passed invalid data.

This function was introduced in Qt 4.1.

See also setInvalidDataPolicy() and InvalidDataPolicy.

bool QDomImplementation::isNull ()

Returns false if the object was created by QDomDocument::implementation(); otherwise returns true.

void QDomImplementation::setInvalidDataPolicy ( InvalidDataPolicy policy )   [static]

Sets the invalid data policy, which specifies what should be done when a factory function in QDomDocument is passed invalid data.

The policy is set for all instances of QDomDocument which already exist and which will be created in the future.

    QDomDocument doc;
    QDomImplementation impl;

    // This will create the element, but the resulting XML document will
    // be invalid, because '~' is not a valid character in a tag name.
    impl.setInvalidDataPolicy(QDomImplementation::AcceptInvalidData);
    QDomElement elt1 = doc.createElement("foo~bar");

    // This will create an element with the tag name "foobar".
    impl.setInvalidDataPolicy(QDomImplementation::DropInvalidData);
    QDomElement elt2 = doc.createElement("foo~bar");

    // This will create a null element.
    impl.setInvalidDataPolicy(QDomImplementation::ReturnNullNode);
    QDomElement elt3 = doc.createElement("foo~bar");

This function was introduced in Qt 4.1.

See also invalidDataPolicy() and InvalidDataPolicy.

bool QDomImplementation::operator!= ( const QDomImplementation & x ) const

Returns true if x and this DOM implementation object were created from different QDomDocuments; otherwise returns false.

QDomImplementation & QDomImplementation::operator= ( const QDomImplementation & x )

Assigns x to this DOM implementation.

bool QDomImplementation::operator== ( const QDomImplementation & x ) const

Returns true if x and this DOM implementation object were created from the same QDomDocument; otherwise returns false.


Copyright © 2006 Trolltech Trademarks
Qt 4.1.3