Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QDomImplementation Class Reference

\reentrant More...

#include <qdom.h>

+ Collaboration diagram for QDomImplementation:

Public Types

enum  InvalidDataPolicy { AcceptInvalidChars = 0 , DropInvalidChars , ReturnNullNode }
 This enum specifies what should be done when a factory function in QDomDocument is called with invalid data. More...
 

Public Member Functions

 QDomImplementation ()
 Constructs a QDomImplementation object.
 
 QDomImplementation (const QDomImplementation &implementation)
 Constructs a copy of implementation.
 
 ~QDomImplementation ()
 Destroys the object and frees its resources.
 
QDomImplementationoperator= (const QDomImplementation &other)
 Assigns other to this DOM implementation.
 
bool operator== (const QDomImplementation &other) const
 Returns true if other and this DOM implementation object were created from the same QDomDocument; otherwise returns false.
 
bool operator!= (const QDomImplementation &other) const
 Returns true if other and this DOM implementation object were created from different QDomDocuments; otherwise returns false.
 
bool hasFeature (const QString &feature, const QString &version) const
 The function returns true if QDom implements the requested version of a feature; otherwise returns false.
 
QDomDocumentType createDocumentType (const QString &qName, const QString &publicId, const QString &systemId)
 Creates a document type node for the name qName.
 
QDomDocument createDocument (const QString &nsURI, const QString &qName, const QDomDocumentType &doctype)
 Creates a DOM document with the document type doctype.
 
bool isNull ()
 Returns false if the object was created by QDomDocument::implementation(); otherwise returns true.
 

Static Public Member Functions

static InvalidDataPolicy invalidDataPolicy ()
 
static void setInvalidDataPolicy (InvalidDataPolicy policy)
 

Friends

class QDomDocument
 

Detailed Description

\reentrant

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

\inmodule QtXml

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 \l{http://www.w3.org/TR/REC-DOM-Level-1/}{Level 1} and \l{http://www.w3.org/TR/DOM-Level-2-Core/}{Level 2 Core}. For a more general introduction of the DOM implementation see the QDomDocument 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. The Qt XML Patterns module and the QXmlStreamReader and QXmlStreamWriter classes have a higher degree of a conformance.

See also
hasFeature()

Definition at line 59 of file qdom.h.

Member Enumeration Documentation

◆ InvalidDataPolicy

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

\value AcceptInvalidChars The 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. \value DropInvalidChars The invalid characters should be removed from the data. \value ReturnNullNode The factory function should return a null node.

See also
setInvalidDataPolicy(), invalidDataPolicy()
Enumerator
AcceptInvalidChars 
DropInvalidChars 
ReturnNullNode 

Definition at line 74 of file qdom.h.

Constructor & Destructor Documentation

◆ QDomImplementation() [1/2]

QDomImplementation::QDomImplementation ( )

Constructs a QDomImplementation object.

Definition at line 371 of file qdom.cpp.

◆ QDomImplementation() [2/2]

QDomImplementation::QDomImplementation ( const QDomImplementation & implementation)

Constructs a copy of implementation.

Definition at line 379 of file qdom.cpp.

References QBasicAtomicInteger< T >::ref(), and QDomImplementationPrivate::ref.

+ Here is the call graph for this function:

◆ ~QDomImplementation()

QDomImplementation::~QDomImplementation ( )

Destroys the object and frees its resources.

Definition at line 428 of file qdom.cpp.

References QBasicAtomicInteger< T >::deref(), and QDomImplementationPrivate::ref.

+ Here is the call graph for this function:

Member Function Documentation

◆ createDocument()

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.

Definition at line 519 of file qdom.cpp.

References QDomNode::appendChild(), QDomDocument::createElementNS(), QDomNode::isNull(), and QDomDocument.

+ Here is the call graph for this function:

◆ createDocumentType()

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 486 of file qdom.cpp.

References fixedPubidLiteral(), fixedSystemLiteral(), fixedXmlName(), QString::isNull(), and ok.

Referenced by XmlWriter::toXml().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hasFeature()

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: \table \header

  • Feature
  • Version \row
  • XML
  • 1.0 \endtable

Definition at line 444 of file qdom.cpp.

References QString::isEmpty().

Referenced by QDomNode::isSupported().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ invalidDataPolicy()

QDomImplementation::InvalidDataPolicy QDomImplementation::invalidDataPolicy ( )
static
Since
4.1 \nonreentrant

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

See also
setInvalidDataPolicy(), InvalidDataPolicy

Definition at line 576 of file qdom.cpp.

References QDomImplementationPrivate::invalidDataPolicy.

◆ isNull()

bool QDomImplementation::isNull ( )

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

Definition at line 533 of file qdom.cpp.

◆ operator!=()

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

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

Definition at line 420 of file qdom.cpp.

References operator==(), and other().

+ Here is the call graph for this function:

◆ operator=()

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

Assigns other to this DOM implementation.

Definition at line 397 of file qdom.cpp.

References QBasicAtomicInteger< T >::deref(), other(), and QDomImplementationPrivate::ref.

+ Here is the call graph for this function:

◆ operator==()

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

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

Definition at line 411 of file qdom.cpp.

References other().

Referenced by operator!=().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setInvalidDataPolicy()

void QDomImplementation::setInvalidDataPolicy ( InvalidDataPolicy policy)
static
Since
4.1 \nonreentrant

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.

{
// This will create the element, but the resulting XML document will
// be invalid, because '~' is not a valid character in a tag name.
QDomElement elt1 = doc.createElement("foo~bar");
// This will create an element with the tag name "foobar".
QDomElement elt2 = doc.createElement("foo~bar");
// This will create a null element.
QDomElement elt3 = doc.createElement("foo~bar");
}
See also
invalidDataPolicy(), InvalidDataPolicy

Definition at line 596 of file qdom.cpp.

References QDomImplementationPrivate::invalidDataPolicy, and policy.

Referenced by XML_snippet_main().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ QDomDocument

friend class QDomDocument
friend

Definition at line 85 of file qdom.h.

Referenced by createDocument().


The documentation for this class was generated from the following files: