37 #include <libxml/parser.h>
45 struct InitAndCleanupTheXMLParserOnlyOnceCommaEver {
46 InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
49 ~InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
52 } gInitAndCleanupTheXMLParserOnlyOnceCommaEver;
60 TXMLParser::TXMLParser()
61 : fContext(0), fValidate(kTRUE), fReplaceEntities(kFALSE), fStopError(kFALSE), fParseCode(0)
68 TXMLParser::~TXMLParser()
77 void TXMLParser::SetValidate(Bool_t val)
85 void TXMLParser::SetReplaceEntities(Bool_t val)
87 fReplaceEntities = val;
93 void TXMLParser::ReleaseUnderlying()
96 fContext->_private = 0;
97 xmlFreeParserCtxt(fContext);
106 void TXMLParser::OnValidateError(
const TString& message)
108 fValidateError += message;
115 void TXMLParser::OnValidateWarning(
const TString& message)
117 fValidateWarning += message;
123 const char *TXMLParser::GetParseCodeMessage(Int_t parseCode)
const
127 return "Attempt to parse a second file while a parse is in progress";
130 return "Parse context is not created";
133 return "An error occured while parsing file";
136 return "A fatal error occured while parsing file";
139 return "Document is not well-formed";
142 return "Document is not valid";
145 return "Parse code does not exist";
153 void TXMLParser::InitializeContext()
155 fContext->linenumbers = 1;
156 fContext->validate = fValidate ? 1 : 0;
157 fContext->replaceEntities = fReplaceEntities ? 1 : 0;
158 fContext->_private =
this;
161 fValidateWarning =
"";
167 void TXMLParser::StopParser()
170 xmlStopParser(fContext);
182 void TXMLParser::SetParseCode(Int_t errorcode)
184 fParseCode = errorcode;
192 void TXMLParser::SetStopOnError(Bool_t stop)