本文整理汇总了C++中QXmlSimpleReader::setEntityResolver方法的典型用法代码示例。如果您正苦于以下问题:C++ QXmlSimpleReader::setEntityResolver方法的具体用法?C++ QXmlSimpleReader::setEntityResolver怎么用?C++ QXmlSimpleReader::setEntityResolver使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QXmlSimpleReader
的用法示例。
在下文中一共展示了QXmlSimpleReader::setEntityResolver方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MMLDocument
bool
MMLReader::parse(const QXmlInputSource &in) {
QXmlSimpleReader p;
// if the previous document was not retrieved, delete it
if (doc) {
delete doc;
}
doc = new MMLDocument();
contentHandler->setDocument(doc);
p.setContentHandler(contentHandler);
p.setErrorHandler(errorHandler);
p.setEntityResolver(entityResolver);
return p.parse(in);
}
示例2: source
TestSuite *TestSuite::openCatalog(QIODevice *input,
QString &errorMsg,
const QUrl &fileName,
const bool useExclusionList,
SuiteType suiteType)
{
Q_ASSERT(input);
QXmlSimpleReader reader;
typedef QPatternist::AutoPtr<QXmlDefaultHandler> HandlerPtr;
HandlerPtr loader;
switch (suiteType) {
case XQuerySuite: loader = HandlerPtr(new TestSuiteHandler(fileName, useExclusionList)); break;
case XsltSuite: loader = HandlerPtr(new XSLTTestSuiteHandler(fileName)); break;
case XsdSuite: loader = HandlerPtr(new XSDTestSuiteHandler(fileName)); break;
default: Q_ASSERT(false); break;
}
reader.setContentHandler(loader.data());
reader.setEntityResolver(loader.data());
QXmlInputSource source(input);
if(!reader.parse(source))
{
errorMsg = QString::fromLatin1("Couldn't parse %1").arg(fileName.toString());
return 0;
}
TestSuite *suite = 0;
switch (suiteType) {
case XQuerySuite: suite = static_cast<TestSuiteHandler *>(loader.data())->testSuite(); break;
case XsltSuite: suite = static_cast<XSLTTestSuiteHandler *>(loader.data())->testSuite(); break;
case XsdSuite: suite = static_cast<XSDTestSuiteHandler *>(loader.data())->testSuite(); break;
default: Q_ASSERT(false); break;
}
if(suite)
return suite;
errorMsg = QString::fromLatin1("Failed to load \"%1\". "
"It appears to have no test-suite element.\n").arg(fileName.toString());
return 0;
}