本文整理汇总了C++中QDomImplementation类的典型用法代码示例。如果您正苦于以下问题:C++ QDomImplementation类的具体用法?C++ QDomImplementation怎么用?C++ QDomImplementation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了QDomImplementation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isNull
bool QDomImplementationProto::isNull()
{
QDomImplementation *item = qscriptvalue_cast<QDomImplementation*>(thisObject());
if (item)
return item->isNull();
return false;
}
示例2: QDomDocument
QDomDocument *XmlWriter::toXml()
{
QDomImplementation implementation;
QDomDocumentType docType = implementation.createDocumentType(
"scribe-document", "scribe", "qt.nokia.com/scribe");
document = new QDomDocument(docType);
// ### This processing instruction is required to ensure that any kind
// of encoding is given when the document is written.
QDomProcessingInstruction process = document->createProcessingInstruction(
"xml", "version=\"1.0\" encoding=\"utf-8\"");
document->appendChild(process);
QDomElement documentElement = document->createElement("document");
document->appendChild(documentElement);
//! [0]
QTextFrame *root = textDocument->rootFrame();
//! [0]
if (root)
processFrame(documentElement, root);
return document;
}
示例3: sipReleaseType
static PyObject *meth_QDomImplementation_hasFeature(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const QString * a0;
int a0State = 0;
const QString * a1;
int a1State = 0;
QDomImplementation *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1", &sipSelf, sipType_QDomImplementation, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State))
{
bool sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = sipCpp->hasFeature(*a0,*a1);
Py_END_ALLOW_THREADS
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
return PyBool_FromLong(sipRes);
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QDomImplementation, sipName_hasFeature, NULL);
return NULL;
}
示例4: xmlMethods
void TestQgsDataDefined::xmlMethods()
{
//create a test dom element
QDomImplementation DomImplementation;
QDomDocumentType documentType =
DomImplementation.createDocumentType(
"qgis", "http://mrcc.com/qgis.dtd", "SYSTEM" );
QDomDocument doc( documentType );
QgsDataDefined dd1;
dd1.setActive( true );
dd1.setField( QString( "field" ) );
dd1.setExpressionString( QString( "expression" ) );
dd1.setUseExpression( true );
QDomElement ddElem = dd1.toXmlElement( doc, "test" );
//test reading
QgsDataDefined dd2;
QVERIFY( dd2 != dd1 );
QVERIFY( dd2.setFromXmlElement( ddElem ) );
QVERIFY( dd2 == dd1 );
//test reading from null element
QDomElement badElem;
QVERIFY( !dd2.setFromXmlElement( badElem ) );
}
示例5: invalidDataPolicy
int QDomImplementationProto::invalidDataPolicy()
{
QDomImplementation *item = qscriptvalue_cast<QDomImplementation*>(thisObject());
if (item)
return item->invalidDataPolicy();
return 0;
}
示例6: exportNamedStyle
void QgsMapLayer::exportNamedStyle( QDomDocument &doc, QString &errorMsg )
{
QDomImplementation DomImplementation;
QDomDocumentType documentType = DomImplementation.createDocumentType( "qgis", "http://mrcc.com/qgis.dtd", "SYSTEM" );
QDomDocument myDocument( documentType );
QDomElement myRootNode = myDocument.createElement( "qgis" );
myRootNode.setAttribute( "version", QString( "%1" ).arg( QGis::QGIS_VERSION ) );
myDocument.appendChild( myRootNode );
myRootNode.setAttribute( "hasScaleBasedVisibilityFlag", hasScaleBasedVisibility() ? 1 : 0 );
myRootNode.setAttribute( "minimumScale", QString::number( minimumScale() ) );
myRootNode.setAttribute( "maximumScale", QString::number( maximumScale() ) );
#if 0
// <transparencyLevelInt>
QDomElement transparencyLevelIntElement = myDocument.createElement( "transparencyLevelInt" );
QDomText transparencyLevelIntText = myDocument.createTextNode( QString::number( getTransparency() ) );
transparencyLevelIntElement.appendChild( transparencyLevelIntText );
myRootNode.appendChild( transparencyLevelIntElement );
#endif
if ( !writeSymbology( myRootNode, myDocument, errorMsg ) )
{
errorMsg = QObject::tr( "Could not save symbology because:\n%1" ).arg( errorMsg );
return;
}
doc = myDocument;
}
示例7: createDocumentType
QDomDocumentType QDomImplementationProto:: createDocumentType(const QString& qName, const QString& publicId, const QString& systemId)
{
QDomImplementation *item = qscriptvalue_cast<QDomImplementation*>(thisObject());
if (item)
return item->createDocumentType(qName, publicId, systemId);
return QDomDocumentType();
}
示例8: hasFeature
bool QDomImplementationProto:: hasFeature(const QString& feature, const QString& version) const
{
QDomImplementation *item = qscriptvalue_cast<QDomImplementation*>(thisObject());
if (item)
return item->hasFeature(feature, version);
return false;
}
示例9: QDomDocumentType
static PyObject *meth_QDomImplementation_createDocumentType(PyObject *sipSelf, PyObject *sipArgs)
{
PyObject *sipParseErr = NULL;
{
const QString * a0;
int a0State = 0;
const QString * a1;
int a1State = 0;
const QString * a2;
int a2State = 0;
QDomImplementation *sipCpp;
if (sipParseArgs(&sipParseErr, sipArgs, "BJ1J1J1", &sipSelf, sipType_QDomImplementation, &sipCpp, sipType_QString,&a0, &a0State, sipType_QString,&a1, &a1State, sipType_QString,&a2, &a2State))
{
QDomDocumentType *sipRes;
Py_BEGIN_ALLOW_THREADS
sipRes = new QDomDocumentType(sipCpp->createDocumentType(*a0,*a1,*a2));
Py_END_ALLOW_THREADS
sipReleaseType(const_cast<QString *>(a0),sipType_QString,a0State);
sipReleaseType(const_cast<QString *>(a1),sipType_QString,a1State);
sipReleaseType(const_cast<QString *>(a2),sipType_QString,a2State);
return sipConvertFromNewType(sipRes,sipType_QDomDocumentType,NULL);
}
}
/* Raise an exception if the arguments couldn't be parsed. */
sipNoMethod(sipParseErr, sipName_QDomImplementation, sipName_createDocumentType, NULL);
return NULL;
}
示例10: createDocument
QDomDocument QDomImplementationProto:: createDocument(const QString& nsURI, const QString& qName, const QDomDocumentType& doctype)
{
QDomImplementation *item = qscriptvalue_cast<QDomImplementation*>(thisObject());
if (item)
return item->createDocument(nsURI, qName, doctype);
return QDomDocument();
}
示例11: qPrintable
void Browser::save(void)
{
std::cout << qPrintable(tr("Saving data")) << std::endl;
QFile file( CFG_FILE );
QDir::setCurrent( CFG_DIR );
if( !file.open( QIODevice::WriteOnly ) )
{
QString strErr = QObject::tr("Error: Can't save config file !");
std::cerr << " " << qPrintable(strErr) << std::endl;
QMessageBox::warning(0,
QObject::tr("Saving config file"),
strErr
);
file.close();
return;
}
std::cout << qPrintable(tr(" ")) << qPrintable(tr("Saving...")) << std::endl;
QDomImplementation impl = QDomDocument().implementation();
QString name_ml = QLatin1String("BrowserML");
QString publicId = QLatin1String("-//CELLES//DTD Browser 0.1 //EN");
QString systemId = QLatin1String("http://www.celles.net/dtd/browser/browser_data-0_1.dtd");
QDomDocument doc(impl.createDocumentType(name_ml,publicId,systemId));
// add some XML comment at the beginning
doc.appendChild(doc.createComment(QLatin1String("This file describe data for a very light browser for dynamic display")));
doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output
doc.appendChild(doc.createComment(QLatin1String("http://www.celles.net/wiki/Browser")));
doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output
QDomElement root = doc.createElement(QLatin1String("browser")); // racine
root.setAttribute( QLatin1String("timer"), timer->interval() );
//std::cout << "timer=" << timer->interval() << std::endl;
doc.appendChild(root);
for (int i=0 ; i<url_list.count() ; i++) {
QDomElement dom_elt = doc.createElement( QLatin1String("url") );
QDomText dom_txt = doc.createTextNode(url_list[i].toString());
dom_elt.appendChild(dom_txt);
root.appendChild( dom_elt );
}
QTextStream ts( &file );
ts << doc.toString();
file.close();
std::cout << qPrintable(tr(" ")) << qPrintable(tr("Data saved")) << std::endl;
}
示例12: QDomDocument
QDomDocument QLCFile::getXMLHeader(const QString& content, const QString& author)
{
if (content.isEmpty() == true)
return QDomDocument();
QDomImplementation dom;
QDomDocument doc(dom.createDocumentType(content, QString(), QString()));
QDomProcessingInstruction instr = doc.createProcessingInstruction(
"xml", "version='1.0' encoding='UTF-8'");
doc.appendChild(instr);
QDomElement root;
QDomElement tag;
QDomElement subtag;
QDomText text;
root = doc.createElement(content);
root.setAttribute("xmlns", KXMLQLCplusNamespace + content);
doc.appendChild(root);
/* Creator tag */
tag = doc.createElement(KXMLQLCCreator);
root.appendChild(tag);
/* Creator name */
subtag = doc.createElement(KXMLQLCCreatorName);
tag.appendChild(subtag);
text = doc.createTextNode(APPNAME);
subtag.appendChild(text);
/* Creator version */
subtag = doc.createElement(KXMLQLCCreatorVersion);
tag.appendChild(subtag);
text = doc.createTextNode(QString(APPVERSION));
subtag.appendChild(text);
/* Author */
subtag = doc.createElement(KXMLQLCCreatorAuthor);
tag.appendChild(subtag);
if (author.isEmpty() == true)
text = doc.createTextNode(currentUserName());
else
text = doc.createTextNode(author);
subtag.appendChild(text);
return doc;
}
示例13: qPrintable
void Data::save(void)
{
std::cout << qPrintable(tr("Saving data")) << std::endl;
QFile file( OC_CFG_FILE );
QDir::setCurrent( OC_CFG_DIR );
if( !file.open( QIODevice::WriteOnly ) )
{
QString strErr = QObject::tr("Error: Can't save config file !");
std::cerr << " " << qPrintable(strErr) << std::endl;
QMessageBox::warning(0,
QObject::tr("Saving config file"),
strErr
);
file.close();
return;
}
std::cout << qPrintable(tr(" ")) << qPrintable(tr("Saving...")) << std::endl;
QDomImplementation impl = QDomDocument().implementation();
QString name_ml = QLatin1String("OpenChronoML");
QString publicId = QLatin1String("-//CELLES//DTD OpenChrono 0.1 //EN");
QString systemId = QLatin1String("http://www.celles.net/dtd/openchrono/openchrono_data-0_1.dtd");
QDomDocument doc(impl.createDocumentType(name_ml,publicId,systemId));
// add some XML comment at the beginning
doc.appendChild(doc.createComment(QLatin1String("This file describe data for OpenChrono a chronometer for mechanical sports")));
doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output
doc.appendChild(doc.createComment(QLatin1String("http://www.celles.net/wikini/wakka.php?wiki=OpenChrono")));
doc.appendChild(doc.createTextNode(QLatin1String("\n"))); // for nicer output
QDomElement root = doc.createElement(QLatin1String("ocdata")); // racine
doc.appendChild(root);
root.appendChild( track.to_node(doc) );
root.appendChild( position.to_node(doc) );
root.appendChild( vehicule.to_node(doc) );
root.appendChild( chrono.to_node(doc) );
QTextStream ts( &file );
ts << doc.toString();
//std::cout << doc.toString();
file.close();
std::cout << qPrintable(tr(" ")) << qPrintable(tr("Data saved")) << std::endl;
}
示例14: document
//---------------------------------------------------------------------------
// asXml
//
//! Return an XML string representing the search spec.
//
//! @return the XML string representation
//---------------------------------------------------------------------------
QString
SearchSpec::asXml() const
{
QDomImplementation implementation;
QDomDocument document(implementation.createDocumentType(
"zyzzyva-search", QString(),
"http://pietdepsi.com/dtd/zyzzyva-search.dtd"));
document.appendChild(asDomElement());
//// XXX: There should be a programmatic way to write the <?xml?> header
//// based on the QDomImplementation, shouldn't there?
return QString("<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n") +
document.toString();
}
示例15: mlNodeList
void QgsLayerTreeUtils::storeOriginalLayersProperties( QgsLayerTreeGroup *group, const QDomDocument *doc )
{
const QDomNodeList mlNodeList( doc->documentElement()
.firstChildElement( QStringLiteral( "projectlayers" ) )
.elementsByTagName( QStringLiteral( "maplayer" ) ) );
std::function<void ( QgsLayerTreeNode * )> _store = [ & ]( QgsLayerTreeNode * node )
{
if ( QgsLayerTree::isLayer( node ) )
{
QgsMapLayer *l( QgsLayerTree::toLayer( node )->layer() );
if ( l )
{
for ( int i = 0; i < mlNodeList.count(); i++ )
{
QDomNode mlNode( mlNodeList.at( i ) );
QString id( mlNode.firstChildElement( QStringLiteral( "id" ) ).firstChild().nodeValue() );
if ( id == l->id() )
{
QDomImplementation DomImplementation;
QDomDocumentType documentType = DomImplementation.createDocumentType( QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ), QStringLiteral( "SYSTEM" ) );
QDomDocument document( documentType );
QDomElement element = mlNode.toElement();
document.appendChild( element );
QString str;
QTextStream stream( &str );
document.save( stream, 4 /*indent*/ );
l->setOriginalXmlProperties( str );
}
}
}
}
else if ( QgsLayerTree::isGroup( node ) )
{
const QList<QgsLayerTreeNode *> constChildren( node->children( ) );
for ( const auto &childNode : constChildren )
{
_store( childNode );
}
}
};
for ( QgsLayerTreeNode *node : group->children() )
{
_store( node );
}
}