2 * Copyright (C) 2012 Intel Corporation
4 * Authors: Regis Merlino <regis.merlino@intel.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #include <libgupnp-av/gupnp-feature-list-parser.h>
26 static const char * const names[] = {
31 static const char * const versions[] = {
36 static const char * const ids[] = {
37 "bookmark1,bookmark2,bookmark3",
41 static const char *text =
42 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
44 "xmlns=\"urn:schemas-upnp-org:av:avs\" "
45 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
46 "xsi:schemaLocation=\""
47 "urn:schemas-upnp-org:av:avs "
48 "http://www.upnp.org/schemas/av/avs-v1-20060531.xsd\">"
49 "<Feature name=\"BOOKMARK\" version=\"1\">"
50 "<objectIDs>bookmark1</objectIDs>"
51 "<objectIDs>bookmark2,bookmark3</objectIDs>"
53 "<Feature name=\"EPG\" version=\"2\">"
54 "<objectIDs>epg1,epg2</objectIDs>"
59 check_feature (GUPnPFeature *feature)
63 if (strcmp (names[index], gupnp_feature_get_name (feature)))
66 if (strcmp (versions[index], gupnp_feature_get_version (feature)))
69 if (strcmp (ids[index], gupnp_feature_get_object_ids (feature)))
78 main (G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
80 GUPnPFeatureListParser *parser;
84 gboolean success = TRUE;
86 #if !GLIB_CHECK_VERSION (2, 35, 0)
90 parser = gupnp_feature_list_parser_new ();
93 features = gupnp_feature_list_parser_parse_text (parser, text, &error);
94 if (features == NULL) {
95 g_printerr ("Parse error: %s\n", error->message);
100 for (item = features; item != NULL; item = g_list_next (item)) {
101 success = check_feature ((GUPnPFeature *) item->data);
108 g_list_free_full (features, g_object_unref);
109 g_object_unref (parser);
111 return (success) ? EXIT_SUCCESS : EXIT_FAILURE;