Commit 9873a594 authored by Nikola Hardi's avatar Nikola Hardi
Browse files

Fix TJAlienCollection XML parse/export

parent 1f62db67
......@@ -334,7 +334,7 @@ TJAlienResult *TJAlien::RunJsonCommand(TString *command, TList *opt)
return RunJsonCommand(command, opt);
}
receive_flag = 0;
receive_flag = 0;
json_object_put(jsonCommand);
json_object * jobj_res = json_tokener_parse(TJAlien::readBuffer.c_str());
......
......@@ -330,7 +330,7 @@ Bool_t TJAlienCollection::ExportXML(TFile * exportfile, Bool_t selected, Bool_t
char outline[4096];
// write headers
snprintf(outline,4096, "<?xml version=\"1.0\"?>\n<jalien>\n <collection name=\"%s\">\n", name);
snprintf(outline,4096, "<?xml version=\"1.0\"?>\n<alien>\n <collection name=\"%s\">\n", name);
if ((exportfile->WriteBuffer(outline, strlen(outline)))) {
Error("ExportXML", "Error writing XML to export file");
exportfile->Close();
......@@ -411,6 +411,11 @@ Bool_t TJAlienCollection::ExportXML(TFile * exportfile, Bool_t selected, Bool_t
(TObjString *) ((TMap *) nextgroup->GetValue(attributes->GetName()))->GetValue(tagname);
if (TString(tagname->GetName()) != "evlist") {
snprintf(outline,4096, "%s=\"%s\" ", tagname->GetName(), tagval->GetName());
// NOTE: (nhardi) dirty hack - see find command json output and compare TGridResult with alien
if(TString(tagname->GetName()) == "lfn") {
snprintf(outline, 4096, "turl=\"alien://%s\" ", tagval->GetName());
}
} else {
// the eventlist has to be converted from TEventList to a string list with komma separation
TEntryList *xmlentrylist = (TEntryList *) tagval;
......@@ -469,7 +474,7 @@ Bool_t TJAlienCollection::ExportXML(TFile * exportfile, Bool_t selected, Bool_t
// write trailer
snprintf(outline,4096, " <info comment=\"%s\" />\n</collection>\n</jalien>\n", comment);
snprintf(outline,4096, " <info comment=\"%s\" />\n</collection>\n</alien>\n", comment);
if ((exportfile->WriteBuffer(outline, strlen(outline)))) {
Error("ExportXML", "Error writing XML to export file");
exportfile->Close();
......@@ -1074,7 +1079,7 @@ void TJAlienCollection::ParseXML(UInt_t maxentries)
XMLNodePointer_t xalien = xml.DocGetRootElement(xdoc);
if (!xalien) {
Error("ParseXML", "cannot find the <jalien> tag in %s", fXmlFile.Data());
Error("ParseXML", "cannot find the <alien> tag in %s", fXmlFile.Data());
return;
}
......@@ -1179,7 +1184,7 @@ void TJAlienCollection::ParseXML(UInt_t maxentries)
if (firstfile) {
files->Add(new TObjString(""), attributes);
firstfile = kFALSE;
} else
}
if (fNofGroups == 1)
fNofGroupfiles++;
} while ((xfile = xml.GetNext(xfile)));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment