#include <GeneratorInterface/LHEInterface/src/XMLUtils.h>
Public Member Functions | |
bool | parse () |
XMLDocument (std::auto_ptr< StorageWrap > &in, Handler &handler) | |
XMLDocument (std::auto_ptr< std::istream > &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< XercesPlatform > | platform |
std::auto_ptr < XERCES_CPP_NAMESPACE_QUALIFIER InputSource > | source |
XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken | token |
Classes | |
class | Handler |
class | XercesPlatform |
Definition at line 33 of file XMLUtils.h.
XMLDocument::XMLDocument | ( | std::auto_ptr< std::istream > & | in, | |
Handler & | handler | |||
) |
Definition at line 54 of file XMLUtils.cc.
References init().
00054 : 00055 platform(new XercesPlatform()), 00056 source(new STLInputSource(in)), 00057 parser(XMLReaderFactory::createXMLReader()), 00058 done(false) 00059 { 00060 init(handler); 00061 }
XMLDocument::XMLDocument | ( | std::auto_ptr< StorageWrap > & | in, | |
Handler & | handler | |||
) |
Definition at line 63 of file XMLUtils.cc.
References init().
00063 : 00064 platform(new XercesPlatform()), 00065 source(new StorageInputSource(in)), 00066 parser(XMLReaderFactory::createXMLReader()), 00067 done(false) 00068 { 00069 init(handler); 00070 }
XMLDocument::~XMLDocument | ( | ) | [virtual] |
Definition at line 72 of file XMLUtils.cc.
References e, lat::endl(), Exception, XMLDocument::parser, and source.
Referenced by XMLDocument().
00073 { 00074 try { 00075 parser->setFeature(XMLUni::fgSAX2CoreValidation, false); 00076 parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, false); 00077 parser->setFeature(XMLUni::fgXercesSchema, false); 00078 parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false); 00079 00080 parser->setContentHandler(&handler); 00081 parser->setLexicalHandler(&handler); 00082 parser->setErrorHandler(&handler); 00083 00084 if (!parser->parseFirst(*source, token)) 00085 throw cms::Exception("XMLParseError") 00086 << "SAXParser::parseFirst failed" << std::endl; 00087 } catch(const XMLException &e) { 00088 throw cms::Exception("XMLDocument") 00089 << "XMLPlatformUtils::Initialize failed because of " 00090 << XMLSimpleStr(e.getMessage()) << std::endl; 00091 } catch(const SAXException &e) { 00092 throw cms::Exception("XMLDocument") 00093 << "XML parser reported: " 00094 << XMLSimpleStr(e.getMessage()) << "." << std::endl; 00095 } 00096 }
bool XMLDocument::parse | ( | ) |
Definition at line 102 of file XMLUtils.cc.
References e, lat::endl(), Exception, and XMLDocument::parser.
00103 { 00104 try { 00105 if (done || parser->getErrorCount()) 00106 return false; 00107 00108 done = !parser->parseNext(token); 00109 } catch(const XMLException &e) { 00110 throw cms::Exception("XMLDocument") 00111 << "XMLPlatformUtils::Initialize failed because of " 00112 << XMLSimpleStr(e.getMessage()) << std::endl; 00113 } catch(const SAXException &e) { 00114 throw cms::Exception("XMLDocument") 00115 << "XML parser reported: " 00116 << XMLSimpleStr(e.getMessage()) << "." << std::endl; 00117 } 00118 00119 return !done; 00120 }
bool lhef::XMLDocument::done [private] |
Definition at line 66 of file XMLUtils.h.
std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER SAX2XMLReader> lhef::XMLDocument::parser [private] |
Definition at line 62 of file XMLUtils.h.
std::auto_ptr<XercesPlatform> lhef::XMLDocument::platform [private] |
Definition at line 59 of file XMLUtils.h.
std::auto_ptr<XERCES_CPP_NAMESPACE_QUALIFIER InputSource> lhef::XMLDocument::source [private] |
Definition at line 61 of file XMLUtils.h.
XERCES_CPP_NAMESPACE_QUALIFIER XMLPScanToken lhef::XMLDocument::token [private] |
Definition at line 64 of file XMLUtils.h.