CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
lhef::XMLDocument Class Reference

#include <XMLUtils.h>

Classes

class  Handler
 
class  XercesPlatform
 

Public Member Functions

bool parse ()
 
 XMLDocument (std::auto_ptr< std::istream > &in, Handler &handler)
 
 XMLDocument (std::auto_ptr< StorageWrap > &in, Handler &handler)
 
virtual ~XMLDocument ()
 

Private Member Functions

void init (Handler &handler)
 

Private Attributes

bool done
 
std::auto_ptr
< XERCES_CPP_NAMESPACE_QUALIFIER
SAX2XMLReader > 
parser
 
std::auto_ptr< XercesPlatformplatform
 
std::auto_ptr
< XERCES_CPP_NAMESPACE_QUALIFIER
InputSource
source
 
XERCES_CPP_NAMESPACE_QUALIFIER
XMLPScanToken 
token
 

Detailed Description

Definition at line 34 of file XMLUtils.h.

Constructor & Destructor Documentation

XMLDocument::XMLDocument ( std::auto_ptr< std::istream > &  in,
Handler handler 
)

Definition at line 56 of file XMLUtils.cc.

References init().

56  :
57  platform(new XercesPlatform()),
58  source(new STLInputSource(in)),
59  parser(XMLReaderFactory::createXMLReader()),
60  done(false)
61 {
62  init(handler);
63 }
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader > parser
Definition: XMLUtils.h:63
XMLInputSourceWrapper< STLInputStream > STLInputSource
Definition: XMLUtils.h:189
void init(Handler &handler)
Definition: XMLUtils.cc:74
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER InputSource > source
Definition: XMLUtils.h:62
std::auto_ptr< XercesPlatform > platform
Definition: XMLUtils.h:60
XMLDocument::XMLDocument ( std::auto_ptr< StorageWrap > &  in,
Handler handler 
)

Definition at line 65 of file XMLUtils.cc.

References init().

65  :
66  platform(new XercesPlatform()),
68  parser(XMLReaderFactory::createXMLReader()),
69  done(false)
70 {
71  init(handler);
72 }
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader > parser
Definition: XMLUtils.h:63
XMLInputSourceWrapper< StorageInputStream > StorageInputSource
Definition: XMLUtils.h:190
void init(Handler &handler)
Definition: XMLUtils.cc:74
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER InputSource > source
Definition: XMLUtils.h:62
std::auto_ptr< XercesPlatform > platform
Definition: XMLUtils.h:60
XMLDocument::~XMLDocument ( )
virtual

Definition at line 100 of file XMLUtils.cc.

101 {
102 }

Member Function Documentation

void XMLDocument::init ( Handler handler)
private

Definition at line 74 of file XMLUtils.cc.

References alignCSCRings::e, edm::hlt::Exception, parser, source, and token.

Referenced by XMLDocument().

75 {
76  try {
77  parser->setFeature(XMLUni::fgSAX2CoreValidation, false);
78  parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false);
79  parser->setFeature(XMLUni::fgXercesSchema, false);
80  parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
81 
82  parser->setContentHandler(&handler);
83  parser->setLexicalHandler(&handler);
84  parser->setErrorHandler(&handler);
85 
86  if (!parser->parseFirst(*source, token))
87  throw cms::Exception("XMLParseError")
88  << "SAXParser::parseFirst failed" << std::endl;
89  } catch(const XMLException &e) {
90  throw cms::Exception("XMLDocument")
91  << "cms::concurrency::xercesInitialize failed because of "
92  << XMLSimpleStr(e.getMessage()) << std::endl;
93  } catch(const SAXException &e) {
94  throw cms::Exception("XMLDocument")
95  << "XML parser reported: "
96  << XMLSimpleStr(e.getMessage()) << "." << std::endl;
97  }
98 }
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader > parser
Definition: XMLUtils.h:63
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER InputSource > source
Definition: XMLUtils.h:62
XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken token
Definition: XMLUtils.h:65
bool XMLDocument::parse ( void  )

Definition at line 104 of file XMLUtils.cc.

References done, alignCSCRings::e, edm::hlt::Exception, parser, and token.

105 {
106  try {
107  if (done || parser->getErrorCount())
108  return false;
109 
110  done = !parser->parseNext(token);
111  } catch(const XMLException &e) {
112  throw cms::Exception("XMLDocument")
113  << "cms::concurrency::xercesInitialize failed because of "
114  << XMLSimpleStr(e.getMessage()) << std::endl;
115  } catch(const SAXException &e) {
116  throw cms::Exception("XMLDocument")
117  << "XML parser reported: "
118  << XMLSimpleStr(e.getMessage()) << "." << std::endl;
119  }
120 
121  return !done;
122 }
std::auto_ptr< XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader > parser
Definition: XMLUtils.h:63
XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken token
Definition: XMLUtils.h:65

Member Data Documentation

bool lhef::XMLDocument::done
private

Definition at line 67 of file XMLUtils.h.

Referenced by parse().

std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader> lhef::XMLDocument::parser
private

Definition at line 63 of file XMLUtils.h.

Referenced by init(), and parse().

std::auto_ptr<XercesPlatform> lhef::XMLDocument::platform
private

Definition at line 60 of file XMLUtils.h.

std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER InputSource> lhef::XMLDocument::source
private

Definition at line 62 of file XMLUtils.h.

Referenced by init().

XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken lhef::XMLDocument::token
private

Definition at line 65 of file XMLUtils.h.

Referenced by init(), and parse().