33 void OnStartDocument() { }
35 void OnStartElement(
const char*,
const TList*);
36 void OnEndElement(
const char*);
37 void OnCharacters(
const char*);
38 void OnComment(
const char*);
39 void OnWarning(
const char*);
40 void OnError(
const char*);
41 void OnFatalError(
const char*);
42 void OnCdataBlock(
const char*,
Int_t);
45 void SaxHandler::OnEndDocument()
50 void SaxHandler::OnStartElement(
const char *
name,
const TList *attributes)
56 TIter next(attributes);
57 while ((attr = (
TXMLAttr*) next())) {
64 void SaxHandler::OnEndElement(
const char *name)
66 cout <<
"</" << name <<
">";
69 void SaxHandler::OnCharacters(
const char *characters)
74 void SaxHandler::OnComment(
const char *
text)
76 cout <<
"<!--" << text <<
"-->";
79 void SaxHandler::OnWarning(
const char *
text)
81 cout <<
"Warning: " << text << endl;
84 void SaxHandler::OnError(
const char *
text)
86 cerr <<
"Error: " << text << endl ;
89 void SaxHandler::OnFatalError(
const char *
text)
91 cerr <<
"FatalError: " << text << endl ;
94 void SaxHandler::OnCdataBlock(
const char *
text,
Int_t len)
96 cout <<
"OnCdataBlock() " <<
text;
104 SaxHandler *saxHandler =
new SaxHandler();
108 saxParser->
ParseFile(dir+
"/xml/saxexample.xml");
TSAXParser is a subclass of TXMLParser, it is a wraper class to libxml library.
const char * GetValue() const
TXMLAttribute is the attribute of an Element.
const char * GetName() const
Returns name of object.
virtual void ConnectToHandler(const char *handlerName, void *handler)
A default TSAXParser to a user-defined Handler connection function.
virtual Int_t ParseFile(const char *filename)
It creates the parse context of the xml file, where the xml file name is filename.