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";
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.
virtual ~TXMLParser()
Cleanup.
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 occured.
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 occured.
Bool_t fStopError
Stop when parse error occurs.