00001 /***************************************************************************** 00002 * xml.c: XML parser wrapper for XML modules 00003 ***************************************************************************** 00004 * Copyright (C) 2004 the VideoLAN team 00005 * $Id: xml.c 11664 2005-07-09 06:17:09Z courmisch $ 00006 * 00007 * Authors: Gildas Bazin <[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 #include <stdlib.h> 00025 #include <vlc/vlc.h> 00026 00027 #include "vlc_xml.h" 00028 00029 /***************************************************************************** 00030 * xml_Create: 00031 ***************************************************************************** 00032 * Create an instance of an XML parser. 00033 * Returns NULL on error. 00034 *****************************************************************************/ 00035 xml_t *__xml_Create( vlc_object_t *p_this ) 00036 { 00037 xml_t *p_xml; 00038 00039 p_xml = vlc_object_create( p_this, VLC_OBJECT_XML ); 00040 vlc_object_attach( p_xml, p_this ); 00041 00042 p_xml->p_module = module_Need( p_xml, "xml", 0, 0 ); 00043 if( !p_xml->p_module ) 00044 { 00045 vlc_object_detach( p_xml ); 00046 vlc_object_destroy( p_xml ); 00047 msg_Err( p_this, "XML provider not found" ); 00048 return NULL; 00049 } 00050 00051 return p_xml; 00052 } 00053 00054 /***************************************************************************** 00055 * xml_Delete: Deletes an instance of xml_t 00056 *****************************************************************************/ 00057 void xml_Delete( xml_t *p_xml ) 00058 { 00059 module_Unneed( p_xml, p_xml->p_module ); 00060 vlc_object_detach( p_xml ); 00061 vlc_object_destroy( p_xml ); 00062 }