[Rivet-svn] r4213 - in branches/2012-06-aidarivet: . src/Tools

blackhole at projects.hepforge.org blackhole at projects.hepforge.org
Fri Mar 8 17:28:18 GMT 2013


Author: buckley
Date: Fri Mar  8 17:28:18 2013
New Revision: 4213

Log:
Protect the AIDA reader against finding XML comments.

Modified:
   branches/2012-06-aidarivet/ChangeLog
   branches/2012-06-aidarivet/src/Tools/RivetAIDA.cc

Modified: branches/2012-06-aidarivet/ChangeLog
==============================================================================
--- branches/2012-06-aidarivet/ChangeLog	Thu Mar  7 17:34:41 2013	(r4212)
+++ branches/2012-06-aidarivet/ChangeLog	Fri Mar  8 17:28:18 2013	(r4213)
@@ -1,3 +1,7 @@
+2013-03-08  Andy Buckley  <andy.buckley at cern.ch>
+
+	* Protect the AIDA reader against finding XML comments.
+
 2013-03-06  Hendrik Hoeth <hendrik.hoeth at cern.ch>
 
 	* Added ATLAS_2012_I1125575 analysis

Modified: branches/2012-06-aidarivet/src/Tools/RivetAIDA.cc
==============================================================================
--- branches/2012-06-aidarivet/src/Tools/RivetAIDA.cc	Thu Mar  7 17:34:41 2013	(r4212)
+++ branches/2012-06-aidarivet/src/Tools/RivetAIDA.cc	Fri Mar  8 17:28:18 2013	(r4213)
@@ -48,8 +48,9 @@
       // Walk down tree to get to the <paper> element
       const TiXmlNode* aidaN = doc.FirstChild("aida");
       if (!aidaN) throw Error("Couldn't get <aida> root element");
-      for (const TiXmlNode* dpsN = aidaN->FirstChild("dataPointSet"); dpsN; dpsN = dpsN->NextSibling()) {
+      for (const TiXmlNode* dpsN = aidaN->FirstChild("dataPointSet"); dpsN; dpsN = dpsN->NextSibling("dataPointSet")) {
         const TiXmlElement* dpsE = dpsN->ToElement();
+        if (dpsE == 0) continue;
         const string plotname = dpsE->Attribute("name");
         const string plotpath = dpsE->Attribute("path");
         /// Check path to make sure that this is a reference histogram.
@@ -60,9 +61,9 @@
 
         /// @todo Check that "path" matches filename
         vector<DPSXYPoint> points;
-        for (const TiXmlNode* dpN = dpsN->FirstChild("dataPoint"); dpN; dpN = dpN->NextSibling()) {
+        for (const TiXmlNode* dpN = dpsN->FirstChild("dataPoint"); dpN; dpN = dpN->NextSibling("dataPoint")) {
           const TiXmlNode* xMeasN = dpN->FirstChild("measurement");
-          const TiXmlNode* yMeasN = xMeasN->NextSibling();
+          const TiXmlNode* yMeasN = xMeasN->NextSibling("measurement");
           if (xMeasN && yMeasN)  {
             const TiXmlElement* xMeasE = xMeasN->ToElement();
             const TiXmlElement* yMeasE = yMeasN->ToElement();
@@ -130,7 +131,7 @@
       // Walk down tree to get to the <paper> element
       const TiXmlNode* aidaN = doc.FirstChild("aida");
       if (!aidaN) throw Error("Couldn't get <aida> root element");
-      for (const TiXmlNode* dpsN = aidaN->FirstChild("dataPointSet"); dpsN; dpsN = dpsN->NextSibling()) {
+      for (const TiXmlNode* dpsN = aidaN->FirstChild("dataPointSet"); dpsN; dpsN = dpsN->NextSibling("dataPointSet")) {
         const TiXmlElement* dpsE = dpsN->ToElement();
         const string plotname = dpsE->Attribute("name");
         const string plotpath = dpsE->Attribute("path");
@@ -142,7 +143,7 @@
 
         /// @todo Check that "path" matches filename
         vector<DPSXPoint> points;
-        for (const TiXmlNode* dpN = dpsN->FirstChild("dataPoint"); dpN; dpN = dpN->NextSibling()) {
+        for (const TiXmlNode* dpN = dpsN->FirstChild("dataPoint"); dpN; dpN = dpN->NextSibling("dataPoint")) {
           const TiXmlNode* xMeasN = dpN->FirstChild("measurement");
           if (xMeasN) {
             const TiXmlElement* xMeasE = xMeasN->ToElement();


More information about the Rivet-svn mailing list