00001 /***************************************************************************** 00002 * xmlparser.hpp 00003 ***************************************************************************** 00004 * Copyright (C) 2004 the VideoLAN team 00005 * $Id: xmlparser.hpp 11664 2005-07-09 06:17:09Z courmisch $ 00006 * 00007 * Authors: Cyril Deguet <[email protected]> 00008 * 00009 * This program is free software; you can redistribute it and/or modify 00010 * it under the terms of the GNU General Public License as published by 00011 * the Free Software Foundation; either version 2 of the License, or 00012 * (at your option) any later version. 00013 * 00014 * This program is distributed in the hope that it will be useful, 00015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 * GNU General Public License for more details. 00018 * 00019 * You should have received a copy of the GNU General Public License 00020 * along with this program; if not, write to the Free Software 00021 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. 00022 *****************************************************************************/ 00023 00024 #ifndef XMLPARSER_HPP 00025 #define XMLPARSER_HPP 00026 00027 #include "../src/skin_common.hpp" 00028 #include "vlc_block.h" 00029 #include "vlc_stream.h" 00030 #include "vlc_xml.h" 00031 #include <map> 00032 00033 // Current DTD version 00034 #define SKINS_DTD_VERSION "2.0" 00035 00037 class XMLParser: public SkinObject 00038 { 00039 public: 00040 XMLParser( intf_thread_t *pIntf, const string &rFileName ); 00041 virtual ~XMLParser(); 00042 00044 bool parse(); 00045 00046 protected: 00047 // Key comparison function for type "const char*" 00048 struct ltstr 00049 { 00050 bool operator()(const char* s1, const char* s2) const 00051 { 00052 return strcmp(s1, s2) < 0; 00053 } 00054 }; 00056 typedef map<const char*, const char*, ltstr> AttrList_t; 00057 00059 bool m_errors; 00060 00062 virtual void handleBeginElement( const string &rName, 00063 AttrList_t &attr ) {} 00064 virtual void handleEndElement( const string &rName ) {} 00065 00066 private: 00067 void LoadCatalog(); 00068 00070 xml_t *m_pXML; 00071 xml_reader_t *m_pReader; 00072 stream_t *m_pStream; 00073 }; 00074 00075 #endif