QDomElement elem; if (elem.isNull()) { // Do something if elem is null. }
QDomElement parent = doc.documentElement(); // Assume 'doc' is a valid QDomDocument object. QDomElement child = parent.firstChildElement(); if (!child.isNull()) { // Do something with the child element. }Both examples use the isNull() function to check if a QDomElement object is null before performing any operations on it. These examples are part of the Qt library package, specifically the QtXml module.