CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
Functions
XMLDocument.cc File Reference
#include <assert.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <memory>
#include <string>
#include <cstdio>
#include <stdio.h>
#include <ext/stdio_filebuf.h>
#include "FWCore/Concurrency/interface/Xerces.h"
#include <xercesc/util/XMLString.hpp>
#include <xercesc/util/XMLUni.hpp>
#include <xercesc/util/BinInputStream.hpp>
#include <xercesc/dom/DOM.hpp>
#include <xercesc/dom/DOMImplementationLS.hpp>
#include <xercesc/dom/DOMWriter.hpp>
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/parsers/XercesDOMParser.hpp>
#include <xercesc/sax/InputSource.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include "FWCore/Utilities/interface/Exception.h"
#include "PhysicsTools/MVATrainer/interface/XMLSimpleStr.h"
#include "PhysicsTools/MVATrainer/interface/XMLUniStr.h"
#include "PhysicsTools/MVATrainer/interface/XMLDocument.h"

Go to the source code of this file.

Functions

static bool isBool (std::string value)
 
static const char * makeBool (bool value)
 

Function Documentation

static bool isBool ( std::string  value)
static

Definition at line 281 of file XMLDocument.cc.

References Exception, and i.

Referenced by XMLDocument::readAttribute(), and XMLDocument::readContent().

282 {
283  for(unsigned int i = 0; i < value.size(); i++)
284  if (value[i] >= 'A' && value[i] <= 'Z')
285  value[i] += 'a' - 'A';
286 
287  if (value == "1" || value == "y" || value == "yes" ||
288  value == "true" || value == "ok")
289  return true;
290 
291  if (value == "0" || value == "n" || value == "no" || value == "false")
292  return false;
293 
294  throw cms::Exception("XMLDocument")
295  << "Invalid boolean value in XML document" << std::endl;
296 }
int i
Definition: DBlmapReader.cc:9
static const char* makeBool ( bool  value)
static

Definition at line 298 of file XMLDocument.cc.

Referenced by XMLDocument::writeAttribute(), and XMLDocument::writeContent().

299 {
300  return value ? "true" : "false";
301 }