Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tinyxml->tinixml2 in CalibTracker/StandaloneTrackerTopology pkg #24518

Merged
merged 2 commits into from Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CalibTracker/StandaloneTrackerTopology/BuildFile.xml
@@ -1,5 +1,5 @@
<use name="DataFormats/TrackerCommon"/>
<use name="tinyxml"/>
<use name="tinyxml2"/>
<export>
<lib name="1"/>
</export>
@@ -1,6 +1,6 @@
#include "CalibTracker/StandaloneTrackerTopology/interface/StandaloneTrackerTopology.h"

#include "tinyxml.h"
#include "tinyxml2.h"
#include "FWCore/Utilities/interface/Exception.h"

namespace {
Expand All @@ -17,12 +17,12 @@ namespace {
return out;
}

class TrackerTopologyExtractor : public TiXmlVisitor
class TrackerTopologyExtractor : public tinyxml2::XMLVisitor
{
public:
bool VisitEnter(const TiXmlElement& elem, const TiXmlAttribute*) override
bool VisitEnter(const tinyxml2::XMLElement& elem, const tinyxml2::XMLAttribute*) override
{
if ( elem.ValueStr() == "Vector" ) {
if ( std::strcmp(elem.Value(), "Vector") == 0 ) {
const std::string att_type{elem.Attribute("type")};
if ( att_type == "numeric" ) {
const std::string att_name{elem.Attribute("name")};
Expand Down Expand Up @@ -168,24 +168,25 @@ namespace {

namespace StandaloneTrackerTopology {
TrackerTopology fromTrackerParametersXMLFile( const std::string& xmlFileName ) {
TiXmlDocument xmlDoc;
if ( xmlDoc.LoadFile(xmlFileName) ) {
tinyxml2::XMLDocument xmlDoc;
xmlDoc.LoadFile(xmlFileName.c_str());
if ( ! xmlDoc.Error() ) {
TrackerTopologyExtractor extr{};
xmlDoc.Accept(&extr);
return extr.getTrackerTopology();
} else {
throw cms::Exception("StandaloneTrackerTopology", std::string{"Failed to parse file "}+xmlFileName+": "+xmlDoc.ErrorDesc());
throw cms::Exception("StandaloneTrackerTopology", std::string{"Failed to parse file "}+xmlFileName+": "+xmlDoc.ErrorStr());
}
}
TrackerTopology fromTrackerParametersXMLString( const std::string& xmlContent ) {
TiXmlDocument xmlDoc;
tinyxml2::XMLDocument xmlDoc;
xmlDoc.Parse(xmlContent.c_str());
if ( ! xmlDoc.Error() ) {
TrackerTopologyExtractor extr{};
xmlDoc.Accept(&extr);
return extr.getTrackerTopology();
} else {
throw cms::Exception("StandaloneTrackerTopology", std::string{"Error while parsing XML: "}+xmlDoc.ErrorDesc());
throw cms::Exception("StandaloneTrackerTopology", std::string{"Error while parsing XML: "}+xmlDoc.ErrorStr());
}
}
}