36#include <libxml/parser.h>
44 struct InitAndCleanupTheXMLParserOnlyOnceCommaEver {
45 InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
48 ~InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
51 } gInitAndCleanupTheXMLParserOnlyOnceCommaEver;
60 : fContext(nullptr), fValidate(
kTRUE), fReplaceEntities(
kFALSE), fStopError(
kFALSE), fParseCode(0)
126 return "Attempt to parse a second file while a parse is in progress";
129 return "Parse context is not created";
132 return "An error occurred while parsing file";
135 return "A fatal error occurred while parsing file";
138 return "Document is not well-formed";
141 return "Document is not valid";
144 return "Parse code does not exist";
TXMLParser is an abstract class which interfaces with Libxml2.
TString fValidateWarning
Parse warning.
virtual void InitializeContext()
Initialize parser parameters, such as, disactivate non-standards libxml1 features,...
TXMLParser()
Initializes parser variables.
virtual void SetParseCode(Int_t code)
Set the parse code:
_xmlParserCtxt * fContext
Parse the xml file.
Int_t fParseCode
To keep track of the errorcodes.
void SetValidate(Bool_t val=kTRUE)
The parser will validate the xml file if val = true.
TString fValidateError
Parse error.
void SetReplaceEntities(Bool_t val=kTRUE)
The parser will replace/expand entities.
virtual void ReleaseUnderlying()
To release any existing document.
Bool_t fValidate
To validate the parse context.
const char * GetParseCodeMessage(Int_t parseCode) const
Returns the parse code message.
virtual void OnValidateWarning(const TString &message)
This function is called when a warning from the parser has occurred.
void SetStopOnError(Bool_t stop=kTRUE)
Set parser stops in case of error:
Bool_t fReplaceEntities
Replace entities.
virtual void StopParser()
Stops parsing.
virtual void OnValidateError(const TString &message)
This function is called when an error from the parser has occurred.
Bool_t fStopError
Stop when parse error occurs.
~TXMLParser() override
Cleanup.