Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

QDomImplementation Class

TheQDomImplementation class provides information about the features of the DOM implementation.More...

Header:#include <QDomImplementation>

Note: All functions in this class arereentrant, except forinvalidDataPolicy() andsetInvalidDataPolicy(), which are nonreentrant.

Public Types

enumInvalidDataPolicy { AcceptInvalidChars, DropInvalidChars, ReturnNullNode }

Public Functions

QDomImplementation()
QDomImplementation(const QDomImplementation & x)
~QDomImplementation()
QDomDocumentcreateDocument(const QString & nsURI, const QString & qName, const QDomDocumentType & doctype)
QDomDocumentTypecreateDocumentType(const QString & qName, const QString & publicId, const QString & systemId)
boolhasFeature(const QString & feature, const QString & version) const
boolisNull()
booloperator!=(const QDomImplementation & x) const
QDomImplementation &operator=(const QDomImplementation & x)
booloperator==(const QDomImplementation & x) const

Static Public Members

InvalidDataPolicyinvalidDataPolicy()
voidsetInvalidDataPolicy(InvalidDataPolicy policy)

Detailed Description

TheQDomImplementation 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 functionQDomDocument::implementation() to get the implementation object.

You can create a new document type withcreateDocumentType() and a new document withcreateDocument().

For further information about the Document Object Model seeLevel 1 andLevel 2 Core. For a more general introduction of the DOM implementation see theQDomDocument documentation.

The QDom classes have a few issues of nonconformance with the XML specifications that cannot be fixed in Qt 4 without breaking backward compatibility. TheQtXmlPatterns module and theQXmlStreamReader andQXmlStreamWriter classes have a higher degree of a conformance.

See alsohasFeature().

Member Type Documentation

enum QDomImplementation::InvalidDataPolicy

This enum specifies what should be done when a factory function inQDomDocument 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 alsosetInvalidDataPolicy() andinvalidDataPolicy().

Member Function Documentation

QDomImplementation::QDomImplementation()

Constructs aQDomImplementation object.

QDomImplementation::QDomImplementation(constQDomImplementation & x)

Constructs a copy ofx.

QDomImplementation::~QDomImplementation()

Destroys the object and frees its resources.

QDomDocument QDomImplementation::createDocument(constQString & nsURI, constQString & qName, constQDomDocumentType & doctype)

Creates a DOM document with the document typedoctype. This function also adds a root element node with the qualified nameqName and the namespace URInsURI.

QDomDocumentType QDomImplementation::createDocumentType(constQString & qName, constQString & publicId, constQString & systemId)

Creates a document type node for the nameqName.

publicId specifies the public identifier of the external subset. If you specify an empty string (QString()) as thepublicId, 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 thesystemId, 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 thecreateDocument() function to create aQDomDocument 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 exampleQDomDocument::createElement(), is called. The document also becomes non-null when setContent() is called.

See alsocreateDocument().

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

The function returns true if QDom implements the requestedversion of afeature; otherwise returns false.

The currently supported features and their versions:

FeatureVersion
XML1.0

[static]InvalidDataPolicy QDomImplementation::invalidDataPolicy()

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

Warning: This function is notreentrant.

This function was introduced in Qt 4.1.

See alsosetInvalidDataPolicy() andInvalidDataPolicy.

bool QDomImplementation::isNull()

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

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

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

Thepolicy is set for all instances ofQDomDocument 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");

Warning: This function is notreentrant.

This function was introduced in Qt 4.1.

See alsoinvalidDataPolicy() andInvalidDataPolicy.

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

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

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

Assignsx to this DOM implementation.

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

Returns true ifx and this DOM implementation object were created from the sameQDomDocument; otherwise returns false.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp