00001 00007 /* 00008 * Copyright (c) Matt Beard 2004 00009 * 00010 * This software is provided 'as-is', without any express or implied warranty. 00011 * In no event will the authors be held liable for any damages arising from 00012 * the use of this software. 00013 * 00014 * Permission is granted to anyone to use this software for any purpose, 00015 * including commercial applications, and to alter it and redistribute it 00016 * freely, subject to the following restrictions: 00017 * 00018 * 1. The origin of this software must not be misrepresented; you must 00019 * not claim that you wrote the original software. If you use this 00020 * software in a product, an acknowledgment in the product 00021 * documentation would be appreciated but is not required. 00022 * 00023 * 2. Altered source versions must be plainly marked as such, and must 00024 * not be misrepresented as being the original software. 00025 * 00026 * 3. This notice may not be removed or altered from any source 00027 * distribution. 00028 */ 00029 00030 #ifndef MXFLIB__XMLPARSE_H 00031 #define MXFLIB__XMLPARSE_H 00032 00033 #ifdef HAVE_EXPAT 00034 00035 namespace mxflib 00036 { 00037 // For the moment re-use the sopSAX handler types 00038 /* Function pointer definitions */ 00039 typedef startElementSAXFunc startElementXMLFunc; 00040 typedef endElementSAXFunc endElementXMLFunc; 00041 typedef warningSAXFunc warningXMLFunc; 00042 typedef errorSAXFunc errorXMLFunc; 00043 typedef fatalErrorSAXFunc fatalErrorXMLFunc; 00044 00045 typedef sopSAXHandler XMLParserHandler; 00046 typedef XMLParserHandler *XMLParserHandlerPtr; 00047 00048 bool XMLParserParseFile(XMLParserHandlerPtr Hand, void *UserData, const char *filename); 00049 } 00050 00051 #else // HAVE_EXPAT 00052 00053 namespace mxflib 00054 { 00055 // Use the sopSAX handler for defining parsing behaviour 00056 typedef startElementSAXFunc startElementXMLFunc; 00057 typedef endElementSAXFunc endElementXMLFunc; 00058 typedef warningSAXFunc warningXMLFunc; 00059 typedef errorSAXFunc errorXMLFunc; 00060 typedef fatalErrorSAXFunc fatalErrorXMLFunc; 00061 00062 typedef sopSAXHandler XMLParserHandler; 00063 typedef XMLParserHandler *XMLParserHandlerPtr; 00064 00066 inline bool XMLParserParseFile(XMLParserHandlerPtr Hand, void *UserData, const char *filename) 00067 { 00068 return sopSAXParseFile(Hand, UserData, filename); 00069 } 00070 } 00071 00072 #endif // HAVE_EXPAT 00073 00074 #endif /* MXFLIB__XMLPARSE_H */ 00075