1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* config-parser.c XML-library-agnostic configuration file parser
4 * Copyright (C) 2003 Red Hat, Inc.
6 * Licensed under the Academic Free License version 1.2
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "config-parser.h"
46 BusConfigParser *parser;
81 struct BusConfigParser
89 bus_config_parser_new (void)
91 BusConfigParser *parser;
93 parser = dbus_new0 (BusConfigParser, 1);
103 bus_config_parser_ref (BusConfigParser *parser)
105 _dbus_assert (parser->refcount > 0);
107 parser->refcount += 1;
111 bus_config_parser_unref (BusConfigParser *parser)
113 _dbus_assert (parser->refcount > 0);
115 parser->refcount -= 1;
117 if (parser->refcount == 0)
126 bus_config_parser_check_doctype (BusConfigParser *parser,
130 if (strcmp (doctype, "busconfig") != 0)
132 dbus_set_error (error,
134 "Document has the wrong type %s",
143 bus_config_parser_start_element (BusConfigParser *parser,
144 const char *element_name,
145 const char **attribute_names,
146 const char **attribute_values,
154 bus_config_parser_end_element (BusConfigParser *parser,
155 const char *element_name,
163 bus_config_parser_content (BusConfigParser *parser,
164 const DBusString *content,