1
xmlファイルを解析するためにlibxml2ライブラリを使用します。 今、いくつかの悪いxmlファイルがあると、lib自体が大きなエラーメッセージを出力しています。以下 libxml2エラーメッセージを表示する方法
は、私はちょうどいないいくつかのエラーを返すようにしたい、私は悪いxmlファイルを持っている場合は、私が代わりにこのmy.xml:4: parser error : attributes construct error
include type="text"this is text. this might be excluded in the next occurrence
my.xml:4: parser error : Couldn't find end of Start Tag include
include type="text"this is text. this might be excluded in the next occurrence
my.xml : failed to parse
のようなエラーを取得し、上記の例ではいくつかのサンプルコード
reader = xmlReaderForFile(filename, NULL, 0);
if (reader != NULL) {
ret = xmlTextReaderRead(reader);
while (ret == 1) {
printf("_________________________________\n");
processNode(reader);
ret = xmlTextReaderRead(reader);
printf("_________________________________\n");
}
xmlFreeTextReader(reader);
if (ret != 0) {
fprintf(stderr, "%s : failed to parse\n", filename);
}
}
です。この醜いlibメッセージで下車してください。
どうすればよいですか?
のthnx。フラグは魅力的に機能しました。 – JohnG
@ JohnGこれを答えとしてマークするのはどうですか? – quaylar