Changeset View
Changeset View
Standalone View
Standalone View
addons/xmlcheck/plugin_katexmlcheck.cpp
Show First 20 Lines • Show All 199 Lines • ▼ Show 20 Line(s) | 193 | if( ! m_validating ) { | |||
---|---|---|---|---|---|
200 | } | 200 | } | ||
201 | QTreeWidgetItem *item = new QTreeWidgetItem(); | 201 | QTreeWidgetItem *item = new QTreeWidgetItem(); | ||
202 | item->setText(0, QString("1").rightJustified(4,' ')); | 202 | item->setText(0, QString("1").rightJustified(4,' ')); | ||
203 | item->setText(3, msg); | 203 | item->setText(3, msg); | ||
204 | listview->addTopLevelItem(item); | 204 | listview->addTopLevelItem(item); | ||
205 | list_count++; | 205 | list_count++; | ||
206 | } | 206 | } | ||
207 | if( ! proc_stderr.isEmpty() ) { | 207 | if( ! proc_stderr.isEmpty() ) { | ||
208 | QStringList lines = proc_stderr.split("\n", QString::SkipEmptyParts); | 208 | QStringList lines = proc_stderr.split('\n', QString::SkipEmptyParts); | ||
209 | QString linenumber, msg; | 209 | QString linenumber, msg; | ||
210 | int line_count = 0; | 210 | int line_count = 0; | ||
211 | for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) { | 211 | for(QStringList::Iterator it = lines.begin(); it != lines.end(); ++it) { | ||
212 | QString line = *it; | 212 | QString line = *it; | ||
213 | line_count++; | 213 | line_count++; | ||
214 | int semicolon_1 = line.indexOf(':'); | 214 | int semicolon_1 = line.indexOf(':'); | ||
215 | int semicolon_2 = line.indexOf(':', semicolon_1+1); | 215 | int semicolon_2 = line.indexOf(':', semicolon_1+1); | ||
216 | int semicolon_3 = line.indexOf(':', semicolon_2+2); | 216 | int semicolon_3 = line.indexOf(':', semicolon_2+2); | ||
▲ Show 20 Lines • Show All 122 Lines • ▼ Show 20 Line(s) | 331 | // otherweise it will not find relative DTDs | |||
339 | 339 | | |||
340 | // Now what about colons in file names or paths? | 340 | // Now what about colons in file names or paths? | ||
341 | // This way xmllint works normally: | 341 | // This way xmllint works normally: | ||
342 | // xmllint --noout --path "/home/user/my/with:colon/" --valid "/home/user/my/with:colon/demo-1.xml" | 342 | // xmllint --noout --path "/home/user/my/with:colon/" --valid "/home/user/my/with:colon/demo-1.xml" | ||
343 | // but because this plugin makes temp file path to file is another and this way xmllint refuses to find dtd: | 343 | // but because this plugin makes temp file path to file is another and this way xmllint refuses to find dtd: | ||
344 | // xmllint --noout --path "/home/user/my/with:colon/" --valid "/tmp/kate.X23725" | 344 | // xmllint --noout --path "/home/user/my/with:colon/" --valid "/tmp/kate.X23725" | ||
345 | // As workaround we can encode ':' with %3A | 345 | // As workaround we can encode ':' with %3A | ||
346 | QString path = kv->document()->url().toString(QUrl::RemoveFilename|QUrl::PreferLocalFile|QUrl::EncodeSpaces); | 346 | QString path = kv->document()->url().toString(QUrl::RemoveFilename|QUrl::PreferLocalFile|QUrl::EncodeSpaces); | ||
347 | path.replace(":","%3A"); | 347 | path.replace(':',"%3A"); | ||
348 | // because of such inconvinience with xmllint and pathes, maybe switch to xmlstarlet? | 348 | // because of such inconvinience with xmllint and pathes, maybe switch to xmlstarlet? | ||
349 | 349 | | |||
350 | qDebug() << "path=" << path; | 350 | qDebug() << "path=" << path; | ||
351 | 351 | | |||
352 | if (!path.isEmpty()) { | 352 | if (!path.isEmpty()) { | ||
353 | args << "--path" << path; | 353 | args << "--path" << path; | ||
354 | 354 | | |||
355 | } | 355 | } | ||
▲ Show 20 Lines • Show All 48 Lines • Show Last 20 Lines |