/usr/include/ucommon/xml.h is in libucommon-dev 3.2.0-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | // Copyright (C) 2006-2010 David Sugar, Tycho Softworks.
//
// This file is part of GNU uCommon C++.
//
// GNU uCommon C++ is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published
// by the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// GNU uCommon C++ is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with GNU uCommon C++. If not, see <http://www.gnu.org/licenses/>.
/**
* XML "SAX" (stream) parsing support from GNU Common C++.
* @file ucommon/xml.h
*/
#ifndef _UCOMMON_STRING_H_
#include <ucommon/string.h>
#endif
#ifndef _UCOMMON_XML_H_
#define _UCOMMON_XML_H_
NAMESPACE_UCOMMON
/**
* XML streaming parser. This class impliments a basic XML stream parser
* that can be used to examine an XML resource thru virtual I/O methods.
* This class must be derived into one that can impliment the physical I/O
* required to parse actual data. A mixer class using XMLParser and
* tcpstream would be one example of this. This can also be used to
* parse xml content in memory buffers easily. This parser is only concerned
* with well-formedness, and does not perform validation.
*
* @author David Sugar <dyfet@gnutelephony.org>
*/
class __EXPORT XMLParser
{
private:
int ecount, dcount;
enum {TAG, CDATA, COMMENT, DTD, AMP, NONE} state;
char *buffer;
unsigned bufpos, bufsize;
__LOCAL bool parseTag(void);
__LOCAL void putBuffer(char c);
__LOCAL void clearBuffer(void);
protected:
/**
* Create xml parser.
* @param size of XML data buffer.
*/
XMLParser(unsigned size = 8192);
/**
* Destroy xml parser.
*/
virtual ~XMLParser();
/**
* Virtual to receive embedded comments in XML document being parsed.
* @param text received.
* @param size of text received.
*/
virtual void comment(caddr_t text, size_t size);
/**
* Virtual to receive character text extracted from the document.
* @param text received.
* @param size of text received.
*/
virtual void characters(caddr_t text, size_t size);
/**
* Notify start of document event.
*/
virtual void startDocument(void);
/**
* Notify end of document event.
*/
virtual void endDocument(void);
/**
* Notify start of an element in the document.
* @param name of element found.
* @param attr list of attributes extracted.
*/
virtual void startElement(caddr_t name, caddr_t *attr) = 0;
/**
* Notify end of an element in the document.
* @param name of element ending.
*/
virtual void endElement(caddr_t name) = 0;
/**
* Parse a chunk of data and return parser completion flag. This is
* used to externally drive data into the XML parser. The return
* status can be used to determine when a document has been fully
* parsed. This can be called multiple times to push stream data
* into the parser.
* @param address of data to parse.
* @param size of data to parse.
*/
bool parse(const char *address, size_t size);
};
END_NAMESPACE
#endif
|