This file looks large and may slow your browser down if we attempt
to syntax highlight it, so we are showing it without any
pretty colors.
Highlight
it anyway.
| 1 |
#include "msoxmlnodemodel.h" |
| 2 |
#include <QXmlSerializer> |
| 3 |
#include <QXmlFormatter> |
| 4 |
#include <QXmlQuery> |
| 5 |
#include <QFileInfo> |
| 6 |
#include <QCoreApplication> |
| 7 |
#include <QDebug> |
| 8 |
|
| 9 |
int |
| 10 |
main(int argc, char** argv) { |
| 11 |
QCoreApplication app(argc, argv); |
| 12 |
if (argc != 3) return -1; |
| 13 |
|
| 14 |
QUrl queryUrl = QUrl::fromLocalFile(argv[1]); |
| 15 |
|
| 16 |
const QXmlNamePool namePool; |
| 17 |
MsoXmlNodeModel model(namePool, argv[2]); |
| 18 |
QXmlNodeModelIndex root = model.root(QXmlNodeModelIndex()); |
| 19 |
|
| 20 |
QXmlQuery query(namePool); |
| 21 |
query.bindVariable("fileTree", root); |
| 22 |
query.setQuery(queryUrl); |
| 23 |
|
| 24 |
QFile out; |
| 25 |
out.open(stdout, QIODevice::WriteOnly); |
| 26 |
|
| 27 |
QXmlFormatter serializer(query, &out); |
| 28 |
query.evaluateTo(&serializer); |
| 29 |
|
| 30 |
return 0; |
| 31 |
} |