iNotify で監視されているフォルダーがあります。フォルダーにファイルが作成されると、ウォッチャーはファイルを取得し、名前を変更して (mv で)、別のフォルダーに移動します。次に、RapidXML プログラムが bash スクリプトで呼び出され、ファイルの XML コンテンツを解析すると想定されます。iNotify プログラムも、RapidXML プログラム スクリプトの呼び出し後に再起動されます。
そのため、RapidXML プログラムを単独で実行すると、ファイルが解析され、必要なすべての処理が行われます。しかし、ウォッチャーを実行し、XML ファイルがウォッチ ディレクトリに配置されると、検出され、名前が変更され、移動されますが、RapidXML プログラムがフリーズまたはキックアウトします (どちらか不明)。
doc.parse<0>(&buffer[0]);
ライン。
RapidXML プログラムのコードのセクションは次のとおりです。
#include "xmlparser.h"
using namespace std;
using namespace rapidxml;
int main(int argc, char * argv[])
{
//variable declaration left out for space purposes
xml_document<> doc;
xml_node<> * root_node;
ifstream theFile("config.xml");
vector<char> buffer((istreambuf_iterator<char>(theFile)), istreambuf_iterator<char>());
buffer.push_back('\0');
doc.parse<0>(&buffer[0]);
// find the root node
root_node = doc.first_node("configuration");
// iterate over the deltas
xml_node<> * deltas_node = root_node->first_node("deltas");
svn = boost::lexical_cast<double>(deltas_node->first_attribute("svn")->value());
svd = boost::lexical_cast<double>(deltas_node->first_attribute("svd")->value());
... //other variable assignments
xml_node<> * report_node = deltas_node->next_sibling("report");
optime = boost::lexical_cast<int>(report_node->first_attribute("optime")->value());
opstatusa = boost::lexical_cast<int>(report_node->first_attribute("opstatusa")->value());
... // other variable assignments
xml_node<> * timing_node = report_node->next_sibling("timing");
timing = boost::lexical_cast<int>(timing_node->first_attribute("timing"));
... // then I do some SQL stuff with the mysql cpp connector.
スクリプトで呼び出されたときに XML ファイルを解析したくない理由を知っている人はいますか?