summaryrefslogtreecommitdiffstats
path: root/addon/xmlread/saxhandlers.h
blob: c9f38b8528f6a79a1acc98052cd9fbdb79fc2b15 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#ifndef _SAXHANDLERS_H
#define _SAXHANDLERS_H

#include "compounddef.h"
#include <sax/HandlerBase.hpp>

/*! SAX Handlers used for pass 1. */
class SaxPass1Handlers : public HandlerBase
{
  public:
    // -----------------------------------------------------------------------
    //! @name Constructors
    // -----------------------------------------------------------------------
    //@{
    /*! Constructor */
    SaxPass1Handlers(CompoundSDict *comp);
    /*! Destructor */
    ~SaxPass1Handlers();
    //@}

    // -----------------------------------------------------------------------
    //! @name Implementations of the SAX DocumentHandler interface
    // -----------------------------------------------------------------------
    //@{
    /*! Handler called at the start of the XML document */
    void startDocument() {}
    /*! Handler called at the end of the XML document */
    void endDocument();
    /*! Handler called when an element is found in the XML file 
     *  \param name The element's name.
     *  \param attributes The list of attributes for the element.
     */
    void startElement(const XMLCh* const name, AttributeList& attributes);
    /*! Handler called when the element of an element is found in the XML file
     *  \param name The element's name.
     */
    void endElement(const XMLCh* const name);
    /*! Handler called when a character string is found in the XML file.
     *  \param chars Zero terminated string of characters.
     *  \param length The number of characters in the string.
     */
    void characters(const XMLCh* const chars, const unsigned int length);

    /*! Handler called when an amount of whitespace is found, that is not
     *  Part of the text.
     */
    void ignorableWhitespace(const XMLCh* const /*chars*/, 
                             const unsigned int /*length*/
                            ) {}

    /*! Handler called when a preprocessing intruction is found.
     */
    void processingInstruction(const XMLCh* const /*target*/, 
                               const XMLCh* const /*data*/
                              ) {}
    //@}

    // -----------------------------------------------------------------------
    //! @name Implementations of the SAX ErrorHandler interface
    // -----------------------------------------------------------------------
    //@{
    /*! Handler called for a parser warning. */ 
    void warning(const SAXParseException& exception);
    /*! Handler called for a parser error. */ 
    void error(const SAXParseException& exception);
    /*! Handler called for a parser fatal error. */ 
    void fatalError(const SAXParseException& exception);
    //@}

    // -----------------------------------------------------------------------
    //! @name Implementation of the SAX DTDHandler interface
    // -----------------------------------------------------------------------
    //@{
    /*! Handler for DTD notation declaration. */
    void notationDecl(const XMLCh* const /*name*/, 
                      const XMLCh* const /*publicId*/, 
                      const XMLCh* const /*systemId*/
                     ) {}

    /*! Handler for DTD unparsed entity declaration. */
    void unparsedEntityDecl(const XMLCh* const /*name*/, 
                            const XMLCh* const /*publicId*/, 
                            const XMLCh* const /*systemId*/, 
                            const XMLCh* const /*notationName*/
                           ) {}
    //@}

  private:
    // -----------------------------------------------------------------------
    //  Private data members
    //
    // -----------------------------------------------------------------------

    enum CharActions { Done, ReadCompoundName };
    CompoundSDict *m_compounds;
    CompoundDef_Impl *m_currentCompound;
    QCString m_compoundName;
    CharActions m_charAction;
};

#endif