library: libXMLParser #include "TSAXParser.h"

# TSAXParser

class description - source file - inheritance tree (.pdf)

## class TSAXParser : public TXMLParser

| Inheritance Chart:

`TObject`

`TQObject`

<-

`TXMLParser`

<-

`TSAXParser`

        private:

          virtual Int_t Parse()

        public:

                          TSAXParser()
                          TSAXParser(const TSAXParser&)
                  virtual ~TSAXParser()
           static TClass* Class()
             virtual void ConnectToHandler(const char* handlerName, void* handler)
          virtual TClass* IsA() const
             virtual void OnCdataBlock(const char* text, Int_t len)
             virtual void OnCharacters(const char* characters)
             virtual void OnComment(const char* text)
             virtual void OnEndDocument()
             virtual void OnEndElement(const char* name)
            virtual Int_t OnError(const char* text)
            virtual Int_t OnFatalError(const char* text)
             virtual void OnStartDocument()
             virtual void OnStartElement(const char* name, const TList* attr)
             virtual void OnWarning(const char* text)
              TSAXParser& operator=(const TSAXParser&)
            virtual Int_t ParseBuffer(const char* contents, Int_t len)
            virtual Int_t ParseFile(const char* filename)
             virtual void ShowMembers(TMemberInspector& insp, char* parent)
             virtual void Streamer(TBuffer& b)
                     void StreamerNVirtual(TBuffer& b)

### Data Members

        private:

          _xmlSAXHandler* fSAXHandler  libxml2 SAX handler

## Class Description

     TSAXParser

     TSAXParser is a subclass of TXMLParser, it is a wraper class to
     libxml library.

     SAX (Simple API for XML) is an event based interface, which doesn't
     maintain the DOM tree in memory, in other words, it's much more
     efficient for large document.

     TSAXParserCallback contains a number of callback routines to the
     parser in a xmlSAXHandler structure. The parser will then parse the
     document and call the appropriate callback when certain conditions
     occur.

TSAXParser()

     Create SAX parser.

~TSAXParser()

     TSAXParser desctructor

void OnStartDocument()

     Emit a signal for OnStartDocument.

void OnEndDocument()

     Emit a signal for OnEndDocument.

void OnStartElement(const char *name, const TList *attributes)

     Emit a signal for OnStarElement, where name is the Element's name and
     attribute is a TList of (TObjString*, TObjString *) TPair's.
     The TPair's key is the attribute's name and value is the attribute's
     value.

void OnEndElement(const char *name)

    Emit a signal for OnEndElement, where name is the Element's name.

void OnCharacters(const char *characters)

     Emit a signal for OnCharacters, where characters are the characters
     outside of tags.

void OnComment(const char *text)

     Emit a signal for OnComment, where text is the comment.

void OnWarning(const char *text)

     Emit a signal for OnWarning, where text is the warning.

Int_t OnError(const char *text)

     Emit a signal for OnError, where text is the error and it returns the
     Parse Error Code, see TXMLParser.

Int_t OnFatalError(const char *text)

     Emit a signal for OnFactalError, where text is the error and it
     returns the Parse Error Code, see TXMLParser.

void OnCdataBlock(const char *text, Int_t len)

     Emit a signal for OnCdataBlock.

Int_t Parse()

     This function parses the xml file, by initializing the parser and checks
     whether the parse context is created or not, it will check as well
     whether the document is well formated.
     It returns the parse error code, see TXMLParser.

Int_t ParseFile(const char *filename)

     It creates the parse context of the xml file, where the xml file name is
     filename. If context is created sucessfully, it will call Parse()
     It returns parse error code, see TXMLParser.

Int_t ParseBuffer(const char *contents, Int_t len)

     It parse the contents, instead of a file.
     It will return error if is attempted to parse a second file while
     a parse is in progres.
     It returns parse code error, see TXMLParser.

void ConnectToHandler(const char *handlerName, void *handler)

     A default TSAXParser to a user-defined Handler connection function.
     This function makes connection between various function from TSAXParser
     with the user-define SAX Handler, whose functions has to be exactly the
     same as in TSAXParser.

     handlerName is the user-defined SAX Handler class name
     handler is the pointer to the user-defined SAX Handler

     See SAXHandler.C tutorial.

### Inline Functions

                TClass* Class()
                TClass* IsA() const
                   void ShowMembers(TMemberInspector& insp, char* parent)
                   void Streamer(TBuffer& b)
                   void StreamerNVirtual(TBuffer& b)
             TSAXParser TSAXParser(const TSAXParser&)
            TSAXParser& operator=(const TSAXParser&)

Author: Jose Lo 12/1/2005
Last update: root/xmlparser:$Name: $:$Id: TSAXParser.cxx,v 1.4 2005/05/11 13:19:50 rdm Exp $
Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *