37 #include <libxml/parser.h> 45 struct InitAndCleanupTheXMLParserOnlyOnceCommaEver {
46 InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
49 ~InitAndCleanupTheXMLParserOnlyOnceCommaEver() {
52 } gInitAndCleanupTheXMLParserOnlyOnceCommaEver;
61 : fContext(0), fValidate(
kTRUE), fReplaceEntities(
kFALSE), fStopError(
kFALSE), fParseCode(0)
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";
virtual void InitializeContext()
Initialize parser parameters, such as, disactivate non-standards libxml1 features, on/off validation, clear error and warning messages.
void SetReplaceEntities(Bool_t val=kTRUE)
The parser will replace/expand entities.
virtual void ReleaseUnderlying()
To release any existing document.
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.
_xmlParserCtxt * fContext
Parse the xml file.
virtual void SetParseCode(Int_t code)
Set the parse code:
virtual void OnValidateError(const TString &message)
This function is called when an error from the parser has occured.
const char * GetParseCodeMessage(Int_t parseCode) const
Returns the parse code message.
void SetStopOnError(Bool_t stop=kTRUE)
Set parser stops in case of error:
TXMLParser()
Initializes parser variables.
virtual void StopParser()
Stops parsing.
TXMLParser is an abstract class which interfaces with Libxml2.
virtual ~TXMLParser()
Cleanup.
Bool_t fValidate
To validate the parse context.
TString fValidateWarning
Parse warning.
Bool_t fReplaceEntities
Replace entities.
Bool_t fStopError
Stop when parse error occurs.
TString fValidateError
Parse error.
virtual void OnValidateWarning(const TString &message)
This function is called when a warning from the parser has occured.