QDomImplementation QDomDocumentProto::implementation() const { QDomDocument *item = qscriptvalue_cast<QDomDocument*>(thisObject()); if (item) return item->implementation(); return QDomImplementation(); }
bool KFormula13ContentHandler::startDocument() { QDomDocumentType dt = QDomImplementation().createDocumentType("math", "-//W3C//DTD MathML 2.0//EN", "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd"); m_mathMlDocument = QDomDocument(dt); QDomProcessingInstruction in = m_mathMlDocument.createProcessingInstruction("xml", "version=\"1.0\" encoding=\"UTF-8\""); m_mathMlDocument.insertBefore(in, m_mathMlDocument.documentElement()); m_currentElement = m_mathMlDocument.documentElement(); return true; }
/** * @brief Creates a skeleton document that must be used for writing the XML tree to the * harddisk. * * As described in the constructor documentation, it contains all application data. * * @return the QDomDocument object */ QDomDocument DataReadWriter::createSkeletonDocument() throw () { const char url[] = "http://qpamat.berlios.de/qpamat.dtd"; QDomDocument doc(QDomImplementation().createDocumentType( "qpamat", 0, url)); // add application-specific data QDomElement root = doc.createElement("qpamat"); doc.appendChild(root); QDomElement appData = doc.createElement("app-data"); root.appendChild(appData); QDomElement version = doc.createElement("version"); QDomText versionValue = doc.createTextNode(VERSION_STRING); version.appendChild(versionValue); appData.appendChild(version); QDomElement date = doc.createElement("date"); QDomText algo = doc.createTextNode(QDateTime::currentDateTime(Qt::UTC).toString(Qt::ISODate)); date.appendChild(algo); appData.appendChild(date); QDomElement cryptAlgorithm = doc.createElement("crypt-algorithm"); QpamatWindow *win = Qpamat::instance()->getWindow(); QDomText algorithm = doc.createTextNode(win->set().readEntry("Security/CipherAlgorithm")); cryptAlgorithm.appendChild(algorithm); appData.appendChild(cryptAlgorithm); QDomElement passwordhash = doc.createElement("passwordhash"); appData.appendChild(passwordhash); QDomElement smartcard = doc.createElement("smartcard"); smartcard.setAttribute("useCard", win->set().readBoolEntry("Smartcard/UseCard")); appData.appendChild(smartcard); // add the empty passwords child QDomElement passwords = doc.createElement("passwords"); root.appendChild(passwords); return doc; }