1/* Copyright (C) 2021 Free Software Foundation, Inc. 2 Contributed by Oracle. 3 4 This file is part of GNU Binutils. 5 6 This program is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 3, or (at your option) 9 any later version. 10 11 This program is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with this program; if not, write to the Free Software 18 Foundation, 51 Franklin Street - Fifth Floor, Boston, 19 MA 02110-1301, USA. */ 20 21/* 22 * org/xml/sax/helpers/DefaultHandler.java 23 * Based on JavaTM 2 Platform Standard Ed. 5.0 24 */ 25 26#ifndef _DefaultHandler_h 27#define _DefaultHandler_h 28 29/* 30 * org/xml/sax/Attributes.java 31 */ 32class Attributes 33{ 34public: 35 virtual ~Attributes () { }; 36 37 virtual int getLength () = 0; 38 virtual const char *getQName (int index) = 0; 39 virtual const char *getValue (int index) = 0; 40 virtual int getIndex (const char *qName) = 0; 41 virtual const char *getValue (const char *qName) = 0; 42}; 43 44/* 45 * org/xml/sax/SAXException.java 46 */ 47class SAXException 48{ 49public: 50 SAXException (); 51 SAXException (const char *message); 52 virtual ~SAXException (); 53 char *getMessage (); 54 55private: 56 char *message; 57}; 58 59class SAXParseException : public SAXException 60{ 61public: 62 SAXParseException (char *message, int lineNumber, int columnNumber); 63 64 int 65 getLineNumber () 66 { 67 return lineNumber; 68 } 69 70 int 71 getColumnNumber () 72 { 73 return columnNumber; 74 } 75 76private: 77 int lineNumber; 78 int columnNumber; 79}; 80 81class DefaultHandler 82{ 83public: 84 virtual ~DefaultHandler () { }; 85 86 virtual void startDocument () = 0; 87 virtual void endDocument () = 0; 88 virtual void startElement (char *uri, char *localName, char *qName, 89 Attributes *attributes) = 0; 90 virtual void endElement (char *uri, char *localName, char *qName) = 0; 91 virtual void characters (char *ch, int start, int length) = 0; 92 virtual void ignorableWhitespace (char *ch, int start, int length) = 0; 93 94 virtual void 95 warning (SAXParseException *e) 96 { 97 delete e; 98 } 99 100 virtual void 101 error (SAXParseException *e) 102 { 103 delete e; 104 } 105 106 virtual void 107 fatalError (SAXParseException *e) 108 { 109 throw ( e); 110 } 111 void dump_startElement (const char *qName, Attributes *attributes); 112}; 113 114#endif /* _DefaultHandler_h */ 115