43#include <libxml/parser.h>
44#include <libxml/parserInternals.h>
54 static void Comment(
void *fParser,
const xmlChar *
value);
56 static void Warning(
void *fParser,
const char *fmt, ...);
57 static void Error(
void *fParser,
const char *fmt, ...);
58 static void FatalError(
void *fParser,
const char *fmt, ...);
109 Emit(
"OnStartDocument()");
117 Emit(
"OnEndDocument()");
132 Emit(
"OnStartElement(const char *, const TList *)", args);
140 Emit(
"OnEndElement(const char *)",
name);
149 Emit(
"OnCharacters(const char *)", characters);
157 Emit(
"OnComment(const char *)",
text);
165 Emit(
"OnWarning(const char *)",
text);
177 Emit(
"OnError(const char *)", errmsg.
Data());
190 Emit(
"OnFatalError(const char *)", errmsg.
Data());
203 Emit(
"OnCdataBlock(const char *, Int_t)", args);
218 xmlSAXHandlerPtr oldSAX =
fContext->sax;
266 fContext = xmlCreateMemoryParserCtxt(contents,
len);
302 for (
const xmlChar **cur =
p; cur && *cur; cur += 2) {
304 (
const char*)*(cur + 1)));
333 char *str =
new char[
len+1];
334 strlcpy(str, (
const char*) ch,
len+1);
363 va_start(arg,
va_(fmt));
364 vsnprintf(buffer, 2048,
va_(fmt), arg);
384 va_start(arg,
va_(fmt));
385 vsnprintf(buffer, 2048,
va_(fmt), arg);
395 if (errorcode < 0 && parser->GetStopOnError()) {
413 va_start(arg,
va_(fmt));
414 vsnprintf(buffer, 2048,
va_(fmt), arg);
449 const TString kFunctionsName [] = {
452 "OnStartElement(const char *, const TList *)",
453 "OnEndElement(const char *)",
454 "OnCharacters(const char *)",
455 "OnComment(const char *)",
456 "OnWarning(const char *)",
457 "OnError(const char *)",
458 "OnFatalError(const char *)",
459 "OnCdataBlock(const char *, Int_t)"
464 for (
Int_t i = 0; i < 10; i++) {
466 cl, kFunctionsName[i]) != -1)
467 Connect(kFunctionsName[i], handlerName, handler, kFunctionsName[i]);
winID h TVirtualViewer3D TVirtualGLPainter p
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void value
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t UChar_t len
Option_t Option_t TPoint TPoint const char text
TClass instances represent classes, structs and namespaces in the ROOT type system.
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
void Add(TObject *obj) override
void Delete(Option_t *option="") override
Remove all objects from the list AND delete all heap based objects.
static Int_t CheckConnectArgs(TQObject *sender, TClass *sender_class, const char *signal, TClass *receiver_class, const char *slot)
Checking of consistency of sender/receiver methods/arguments.
void Emit(const char *signal, const T &arg)
Activate signal with single parameter.
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
static void Comment(void *fParser, const xmlChar *value)
Comment callback function.
static void StartDocument(void *fParser)
StartDocument Callback function.
static void CdataBlock(void *fParser, const xmlChar *value, Int_t len)
CdataBlock Callback function.
static void Characters(void *fParser, const xmlChar *ch, Int_t len)
Character callback function.
static void Warning(void *fParser, const char *fmt,...)
Warning callback function.
static void StartElement(void *fParser, const xmlChar *name, const xmlChar **p)
StartElement callback function, where name is the name of the element and p contains the attributes f...
static void Error(void *fParser, const char *fmt,...)
Error callback function.
static void EndDocument(void *fParser)
EndDocument callback function.
static void EndElement(void *fParser, const xmlChar *name)
EndElement callback function, where name is the name of the element.
static void FatalError(void *fParser, const char *fmt,...)
FactalError callback function.
TSAXParser is a subclass of TXMLParser, it is a wraper class to libxml library.
virtual void OnWarning(const char *text)
Emit a signal for OnWarning, where text is the warning.
virtual void OnCdataBlock(const char *text, Int_t len)
Emit a signal for OnCdataBlock.
virtual Int_t Parse()
This function parses the xml file, by initializing the parser and checks whether the parse context is...
virtual Int_t OnFatalError(const char *text)
Emit a signal for OnFactalError, where text is the error and it returns the Parse Error Code,...
TClass * IsA() const override
virtual void OnCharacters(const char *characters)
Emit a signal for OnCharacters, where characters are the characters outside of tags.
TSAXParser()
Create SAX parser.
Int_t ParseBuffer(const char *contents, Int_t len) override
It parse the contents, instead of a file.
virtual void OnComment(const char *text)
Emit a signal for OnComment, where text is the comment.
virtual void OnStartElement(const char *name, const TList *attr)
Emit a signal for OnStarElement, where name is the Element's name and attribute is a TList of (TObjSt...
virtual void OnEndDocument()
Emit a signal for OnEndDocument.
~TSAXParser() override
TSAXParser desctructor.
virtual void ConnectToHandler(const char *handlerName, void *handler)
A default TSAXParser to a user-defined Handler connection function.
virtual void OnStartDocument()
Emit a signal for OnStartDocument.
virtual void OnEndElement(const char *name)
Emit a signal for OnEndElement, where name is the Element's name.
Int_t ParseFile(const char *filename) override
It creates the parse context of the xml file, where the xml file name is filename.
virtual Int_t OnError(const char *text)
Emit a signal for OnError, where text is the error and it returns the Parse Error Code,...
_xmlSAXHandler * fSAXHandler
libxml2 SAX handler
const char * Data() const
void Form(const char *fmt,...)
Formats a string using a printf style format descriptor.
TXMLAttribute is the attribute of an Element.
virtual void InitializeContext()
Initialize parser parameters, such as, disactivate non-standards libxml1 features,...
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.
virtual void ReleaseUnderlying()
To release any existing document.
virtual void StopParser()
Stops parsing.